Speed up mse.handshake.establishS

Remove possible slice allocation, and avoid reflect.
This commit is contained in:
Matt Joiner 2016-09-30 12:14:34 +10:00
parent 47ef753795
commit d72d93bba7
1 changed files with 2 additions and 2 deletions

View File

@ -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
}