Web3JS Online
Viem Online
Webhooks, Alerts, and a simple API.
keccak256 is a function that calculates the Keccak256 hash of a given input value. The Keccak256 hash is a 256-bit hash value that is commonly used in various applications, including cryptocurrencies like Bitcoin and Ethereum.
The function takes a single parameter, value, which can be either a hex string or a byte array. The to parameter is optional and specifies the output format of the hash value. If not specified, the default output format is a hex string.
The function returns the Keccak256 hash value of the input value. If the input is a hex string, it is first converted to a byte array before hashing. The resulting hash value is then returned as a hex string or byte array, depending on the specified output format.
Here are some examples of how to use the keccak256 function:
To hash a byte array:
To hash a hex string: