crypto.md5: fix u64 modulus operation
parent
0fc9ada0aa
commit
fbd414fd2f
|
@ -106,7 +106,7 @@ pub fn (d mut Digest) checksum() []byte {
|
||||||
// tmp := [1 + 63 + 8]byte{0x80}
|
// tmp := [1 + 63 + 8]byte{0x80}
|
||||||
mut tmp := [byte(0)].repeat(1 + 63 + 8)
|
mut tmp := [byte(0)].repeat(1 + 63 + 8)
|
||||||
tmp[0] = 0x80
|
tmp[0] = 0x80
|
||||||
pad := (55 - int(d.len)) % 64 // calculate number of padding bytes
|
pad := int((55 - int(d.len)) % u64(64)) // calculate number of padding bytes
|
||||||
binary.little_endian_put_u64(mut tmp.right(1+pad), d.len<<u64(3)) // append length in bits
|
binary.little_endian_put_u64(mut tmp.right(1+pad), d.len<<u64(3)) // append length in bits
|
||||||
d.write(tmp.left(1+pad+8))
|
d.write(tmp.left(1+pad+8))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue