TRY ONLINE

Input
Hash

EXAMPLES

Hashes whatever you give it with keccak256:
cast keccak "I tried auditioning at the foundry, but they said: Sorry, we only cast iron."
0x83ee1d1103f1f612ae164e30f597409cbebed0c5168f31b12cce1a0fc0f90bf3
Useful for getting the function selector of a function signature. Just pass the function signature as a string and get the first 4 bytes of the hash:
cast keccak "transfer(address,uint256)"
0xa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b
Works with hex values too:
cast keccak 0x1234
0x56570de287d73cd1cb6092bb8fdee6173974955fdef345ae579ee9f475ea7432

DOCUMENTATION

cast keccak


Hash arbitrary data using Keccak-256

$ cast keccak --help
Usage: cast keccak [OPTIONS] [DATA]

Arguments:
  [DATA]
          The data to hash

Options:
  -h, --help
          Print help (see a summary with '-h')

  -j, --threads <THREADS>
          Number of threads to use. Specifying 0 defaults to the number of
          logical cores
          
          [aliases: --jobs]

Display options:
      --color <COLOR>
          The color of the log messages

          Possible values:
          - auto:   Intelligently guess whether to use color output (default)
          - always: Force color output
          - never:  Force disable color output

      --json
          Format log messages as JSON

  -q, --quiet
          Do not print log messages

  -v, --verbosity...
          Verbosity level of the log messages.
          
          Pass multiple times to increase the verbosity (e.g. -v, -vv, -vvv).
          
          Depending on the context the verbosity levels have different meanings.
          
          For example, the verbosity levels of the EVM are:
          - 2 (-vv): Print logs for all tests.
          - 3 (-vvv): Print execution traces for failing tests.
          - 4 (-vvvv): Print execution traces for all tests, and setup traces
          for failing tests.
          - 5 (-vvvvv): Print execution and setup traces for all tests,
          including storage changes.