From d72d93bba7e36b8fb1ca133e02f34dcd840c6922 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 30 Sep 2016 12:14:34 +1000 Subject: [PATCH] Speed up mse.handshake.establishS Remove possible slice allocation, and avoid reflect. --- mse/mse.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mse/mse.go b/mse/mse.go index d366aa75..93a80a6b 100644 --- a/mse/mse.go +++ b/mse/mse.go @@ -17,7 +17,6 @@ import ( "strconv" "sync" - "github.com/anacrolix/missinggo" "github.com/bradfitz/iter" ) @@ -167,7 +166,8 @@ func (h *handshake) establishS() (err error) { var Y, S big.Int Y.SetBytes(b[:]) S.Exp(&Y, &x, &p) - missinggo.CopyExact(&h.s, paddedLeft(S.Bytes(), 96)) + sBytes := S.Bytes() + copy(h.s[96-len(sBytes):96], sBytes) return } -- 2.50.0