mirror of
https://github.com/golang/go
synced 2024-11-24 21:10:04 -07:00
pad and excess bytes here do essentially the same thing
This commit is contained in:
parent
cf32f07fa8
commit
ff91df91b6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user