hash
Compute cryptographic, CRC, or fast non-crypto digests from input bytes. Supports algorithms like SHA-256, CRC32, xxHash, and BLAKE2 with configurable input and output formats.
Instructions
Compute a cryptographic, CRC, or fast non-crypto digest of bytes.
length (output bytes) is required for shake_*; key keys blake2b/blake2s
(decoded with input_format); seed reseeds xxh*/fnv1a_*.
Returns {algorithm, digest, output_format, bits}; CRC and fast hashes
additionally report their integer value as int.
Example: hash("abc", "sha256") -> digest
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Input to hash, decoded to bytes via `input_format`. | |
| algorithm | Yes | Digest algorithm: crypto (md5/sha1/sha2/sha3/blake2*), shake_128/shake_256 (need `length`), CRC (crc8/16/32/32c/64), xxhash (xxh32/64/3_64/3_128), or fnv1a_32/fnv1a_64. | |
| input_format | No | How `data` (and `key`) are decoded; default 'text'. | text |
| output_format | No | How the digest is rendered (bare hex, no 0x); default 'hex'. | hex |
| length | No | Output length in bytes, required for shake_128/shake_256 and invalid otherwise. Default None. | |
| key | No | Key for blake2b/blake2s only, decoded with `input_format`. Default None. | |
| seed | No | Seed reseeding xxh*/fnv1a_* only. Default None. |