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
When the length of the input data is not a multiple of 16, TransformBlock() does not behave correctly. In the following example, the same hash is generated for different byte sequences:
In the above example, all inputs to TransformSingleByte() are of size 1, which is less than the MurmurHash block size (16).
What happens is that HashCore() calls Body(), which calls Tail() with the input. Tail() does a calculation on the input and then XORs the result with H1 and H2. This means that when we call TransformBlock() twice with the same input, the effect cancels out (because X ^ Y ^ Y == X).
What HashCore() should have done is aggregate complete blocks and run the algorithm on them. The "tail" logic should only be used when HashFinal() is called.
itai
changed the title
TransformBlock() behaves incorrectly on unaligned input
TransformBlock() behaves incorrectly when input data length is not a multiple of 16
Sep 14, 2022
When the length of the input data is not a multiple of 16, TransformBlock() does not behave correctly. In the following example, the same hash is generated for different byte sequences:
Output:
The text was updated successfully, but these errors were encountered: