The hash function returns incorrect result for any inputs where byteLength % 64 == 63. To reproduce create a test case where byte length % 64 == 63 and compare it against another implementation of sha256.
digest function
hex bytes of 575 byte length:
AssertionError: expected '758a6d0187dfd01483d6a7e742bdda25a2f47…' to equal 'fc6b0073005a8ce2b4bf9a9c482bb2b1707bc…'
+ expected - actual
-758a6d0187dfd01483d6a7e742bdda25a2f47ef804fed45423484b27a6717243
+fc6b0073005a8ce2b4bf9a9c482bb2b1707bc1dab06c0185752104157edb62c6
at Context.<anonymous> (test/unit/index.test.ts:22:28)
at processImmediate (node:internal/timers:478:21)
I am still working through why this behavior occurs - I believe this could be an edge case in the math that is not handled correctly, any assistance on this would be greatly appreciated.
The hash function returns incorrect result for any inputs where
byteLength % 64 == 63
. To reproduce create a test case where byte length % 64 == 63 and compare it against another implementation of sha256.example test one:
example one output running
yarn test
example two
example two output running
yarn test
I am still working through why this behavior occurs - I believe this could be an edge case in the math that is not handled correctly, any assistance on this would be greatly appreciated.