1
0
mirror of https://github.com/golang/go synced 2024-11-21 22:34:48 -07:00

pad and excess bytes here do essentially the same thing

This commit is contained in:
schou 2021-01-06 10:56:47 -05:00
parent cf32f07fa8
commit ff91df91b6

View File

@ -69,14 +69,11 @@ func hashToBytes(dst, hash []byte, c elliptic.Curve) {
panic("crypto/ecdsa: dst too small to fit value")
}
// pad with zeros
pad := lenDst - orderBits/8
for i := 0; i <= pad; i++ {
dst[i] = 0
}
// figure out the excess bytes between the hash size and order of the curve
excess := lenDst - orderBytes
for i := 0; i < excess; i++ {
dst[i] = 0
}
// determine the shifts needed
truncateBits := ((orderBits - 1) % 8) + 1