2

I want to test this StackExchange Q/A.

which got 889DA12A88D36BCE0966AB1A79125779DD1F2FC6F1145DE131FD52A5B468796D from

% keccak -256 198584347013dd91832be3d82529437db7cc8e1850e559cdd3872b29ca819601

However, when I use the Keccak-256 online tool found here: https://emn178.github.io/online-tools/keccak_256.html

I get: 11d0c17e049fd25f195a6b3694d37658240961d55f263cca40f2c5f91e6fac2d

The results are not the same. Is there anything wrong?

Mooooo
  • 459
  • 2
  • 8

1 Answers1

2

The online tool works perfectly, but the form accepts text and you were pasting in hex. The ASCII string "198584347013dd91832be3d82529437db7cc8e1850e559cdd3872b29ca819601" is 31393835383433343730313364643931383332626533643832353239343337646237636338653138353065353539636464333837326232396361383139363031 in hex, and the online tool correctly produced a keccak256 hash of the hex of what you pasted in.

The result of your keccak -256 command is also correct.

knaccc
  • 8,468
  • 16
  • 22
  • Sorry I don't get it.. If I past "31393835383433343730313364643931383332626533643832353239343337646237636338653138353065353539636464333837326232396361383139363031" to the online tool, I still can't get the right answer. – Mooooo Feb 13 '20 at 09:13
  • It shows a0aad49db54af4cfb5de9fb29a37131ccf1051a1068c190a4a5fd07c369c8681. But the answer is 889DA12A88D36BCE0966AB1A79125779DD1F2FC6F1145DE131FD52A5B468796D – Mooooo Feb 13 '20 at 09:14
  • @Mooooo The online tool cannot accept hex, it can only accept ascii. But your keccak command line tool can accept hex, so you'll see that if you do keccak -256 31393835383433343730313364643931383332626533643832353239343337646237636338653138353065353539636464333837326232396361383139363031 the answer will be 11d0c17e049fd25f195a6b3694d37658240961d55f263cca40f2c5f91e6fac2d, exactly the same as the online tool reported. – knaccc Feb 13 '20 at 09:48