Keccak256
Ethereum has the hash function keccak256
built-in, which is a version of SHA3. A hash function basically maps an input into a random 256-bit hexadecimal number. A slight change in the input will cause a large change in the hash.
keccak256
expects a single parameter of type bytes. This means that we have to "pack" any parameters before calling keccak256:
As you can see, the returned values are totally different despite only a 1-character change in the input.
Last updated