-3

Hex and ASCII are encoded with the same binary code. Why is it that a message in ASCII and the same message in hexadecimal produce different hashes?

For example, the message helping strangers over the internet is fun!!!!!!!!!!!!!!!!!!!!!! gives the hash 8029b81d7b1c01460710c855651d2f44062e57fca135987a8558f30d0264e07bea1be37e759bd9059b11758be47bef473e9691526acda84089d10415e327ef7a,

while a hex of the message, 68656c70696e6720737472616e67657273206f7665722074686520696e7465726e65742069732066756e21212121212121212121212121212121212121212121 gives another hash, d19bf1494bd6a3f71794dd5a07e83fde48147ab0e3736348af61e73fcddfc2733ba6d89740d3d99667dff9bed3ce1a61ad6215b4cfdfdb09eaf86b1d20280ce1

hashes via https://emn178.github.io/online-tools/keccak_512.html

a5c1
  • 1
  • 1

1 Answers1

3

What you are calling hex is actually an ascii encoded, hex encoded string. In other words, it is something like ascii(hex(string)). In the other case you are just passing the ascii string.

Put another way, the tool you are using is expecting an ascii string. So by typing 686564 and so on, you are ascii encoding the hex encoded string.

So it makes sense that you are getting a different output. Note that this will happen with all hash functions, not just SHA3.

mikeazo
  • 38,563
  • 8
  • 112
  • 180