Incorrect SHA-3 computation for message length just below multiple of block size
erich-9 opened this issue · 1 comments
erich-9 commented
I just noticed that the SHA-3 functions yield incorrect results if the length of the message is one byte less than a multiple of the block size. Taking as an example sha3_512
and a message of length 71:
julia> using SHA; bytes2hex(sha3_512(zeros(UInt8, SHA.blocklen(SHA.SHA3_512_CTX) - 1)))
"67dd0c8d9120f2772eac8c9287888a2f6128ce21f8894734f71ce4943e71f0e60f72823986c9a1c82f38d94fdbdc1905fc5df19c09499ea356950767d0812714"
However, the correct hash is:
"cd87417194c917561a59c7f2eb4b95145971e32e8e4ef3b23b0f190bfd29e3692cc7975275750a27df95d5c6a99b7a341e1b8a38a750a51aca5b77bae41fbbfc"
erich-9 commented
Thanks for the quick fix!