You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see in your SHA-2 implementation that you are using let len = length.checked_shl(3).unwrap(); to convert byte length to bit length. This doesn't make sense because x.checked_shl(s) only checks for overflow of s, not of the result, so checked_shl(3) isn't equivalent to checked_mul(8) w.r.t. overflow checking.
The text was updated successfully, but these errors were encountered:
Thanks a lot for taking the time to report this, @briansmith.
I agree, this doesn't really make sense. An overflow should be unreachable on this path from user-input, so as you say it doesn't really make sense to use checked_shl(3) here. We could just use plain <<, but I think checked_mul(8) would better convey the implicit condition of unreachable overflow.
(In case "bug" label was added automatically, please ignore this.) I'm removing the bug-label, as a user cannot trigger an overflow on this path, as far as I'm aware.
I see in your SHA-2 implementation that you are using
let len = length.checked_shl(3).unwrap();
to convert byte length to bit length. This doesn't make sense becausex.checked_shl(s)
only checks for overflow ofs
, not of the result, sochecked_shl(3)
isn't equivalent tochecked_mul(8)
w.r.t. overflow checking.The text was updated successfully, but these errors were encountered: