have the stream code use bufio instead of copying manually to an input buffer, slightly reduces total uses of memmove

This commit is contained in:
Arceliar
2019-08-04 15:21:04 -05:00
parent 75b931f37e
commit 0ba8c6a34f
2 changed files with 30 additions and 49 deletions

View File

@@ -172,7 +172,7 @@ func BoxOpen(shared *BoxSharedKey,
boxed []byte,
nonce *BoxNonce) ([]byte, bool) {
out := util.GetBytes()
return append(out, boxed...), true
return append(out, boxed...), true //FIXME disabled crypto for benchmarking
s := (*[BoxSharedKeyLen]byte)(shared)
n := (*[BoxNonceLen]byte)(nonce)
unboxed, success := box.OpenAfterPrecomputation(out, boxed, n, s)
@@ -185,7 +185,7 @@ func BoxSeal(shared *BoxSharedKey, unboxed []byte, nonce *BoxNonce) ([]byte, *Bo
}
nonce.Increment()
out := util.GetBytes()
return append(out, unboxed...), nonce
return append(out, unboxed...), nonce // FIXME disabled crypto for benchmarking
s := (*[BoxSharedKeyLen]byte)(shared)
n := (*[BoxNonceLen]byte)(nonce)
boxed := box.SealAfterPrecomputation(out, unboxed, n, s)