Open thogiti opened 1 month ago
A better solution for this issue might be to use the original Blake implementation directly, wrapping it with a TS class.
Hey, if you need someone to work on this I would be happy to do so and replace the custom implementation with a wrapper over this implementation
Incorrect Carry Handling in the
g
FunctionThe
g
function in Implementation inblake.ts
uses~~(lo / 0x0100000000)
to compute the carry from the lower 32 bits of a 64-bit word.Since
lo
can be up to0x2FFFFFFFC
(i.e., approximately 3 times0x0100000000
), the carry can erroneously be 2 or 3.Impact
Recommendation