Closed zacyu closed 5 years ago
Hi Zac - In this case, you should take the number of remaining spaces (n) and take the length modulo 16^n (0x10 ^ n) (since that is the max hex value that can be stored). For example, in your case the length is 0x17 but 0x17 % 0x10 (23 % 16) = 0x7, so we store a 7 there.
Example:
(1374) $ java LaboonHash "no more mr. nice guy..." -verbose
Padded string: no more mr. nice guy...7
Blocks:
no more
mr. nice
guy...7
Iterating with 1AB0 / no more = F74E
Iterating with F74E / mr. nice = F963
Iterating with F963 / guy...7 = 5308
Final result: 5308
LaboonHash hash = 5308
Let me know if you have other questions or feel free to close this issue if that answers your question.
Also +0.5 EC, I am going to clarify this on the D3 paperwork now.
Thanks for the clarification. That answered my question.
The version of Merkle-Damgard strengthening we use for LaboonHash keeps the length of the input as part of the padding (in the last block, whenever space permits) instead of keeping it in a new block. I noticed from the verbose sample output of LaboonHash that when there is no padding space, e.g. in the case of
no more mr. nice guy....
, the input length is omitted.However, it is possible to have some padding space yet insufficient for placing the input length. For example, we can have input
no more mr. nice guy...
(three dots instead of four), leaving us with one char of space for padding; however, the length of the input in hex would be17
, which is two characters long. In this case, should we pad it with a single0
without strengthening or with part of the input length (e.g.1
from the MSD, or7
from the LSD)?