From: Matt Joiner Date: Fri, 30 Sep 2016 02:14:34 +0000 (+1000) Subject: Speed up mse.handshake.establishS X-Git-Tag: v1.0.0~567 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=d72d93bba7e36b8fb1ca133e02f34dcd840c6922;p=btrtrc.git Speed up mse.handshake.establishS Remove possible slice allocation, and avoid reflect. --- 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 }