emn178/online-tools

Pad10*1 of input

anhtai090601 opened this issue · 4 comments

when i use SHA3-224 to calculate 2 input hexadecimal: 00112233445566778899AABBCCDDEEFF and 00112233445566778899AABBCCDDEEFF0.
I have 2 different results. Can anyone tell me how the input was processed before implementation?

emn178 commented

Hex will convert to bytes first. If the length is not multiples of two, it will prepend 0. For example, FF0 will be the same with 0FF0

Hex will convert to bytes first. If the length is not multiples of two, it will prepend 0. For example, FF0 will be the same with 0FF0
Can you explain in more detail? I still do not understand.

emn178 commented

FF is one byte [255]
FF0 is two bytes [15, 240]. It is 0FF0 not FF00.

In your case:
00112233445566778899AABBCCDDEEFF is [0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255]
00112233445566778899AABBCCDDEEFF0 is [0, 1, 18, 35, 52, 69, 86, 103, 120, 137, 154, 171, 188, 205, 222, 239, 240]

Okay thanks you, Now i'm understand