BLAKE2F
Hashing
The BLAKE2b compression function F, run for a caller-specified number of rounds.
| Address | 0x0000000000000000000000000000000000000009 |
|---|---|
| Name | BLAKE2F |
| Minimum gas | 0 |
| Input | 213 bytes |
| Output | 64 bytes |
| Available since | Istanbul |
Input
rounds4 B
h64 B
m128 B
t16 B
f1 B
| Offset | Length | Field | Description |
|---|---|---|---|
| 0 | 4 | rounds | Number of compression rounds, big-endian. This is also the gas cost. |
| 4 | 64 | h | State vector, 8 × 8-byte little-endian words. |
| 68 | 128 | m | Message block vector, 16 × 8-byte little-endian words. |
| 196 | 16 | t | Offset counters t0, t1, little-endian. |
| 212 | 1 | f | Final block indicator: 0 or 1. Any other value reverts. |
Output
The updated 64-byte state vector h.
Gas
1 × rounds
Gas is exactly the `rounds` value taken from the first four bytes of the input, so the caller chooses the cost. Malformed input is charged zero gas and then reverts.
Failure behaviour
- Reverts if the input is not exactly 213 bytes.
- Reverts if the final-block flag is neither 0 nor 1.
Calling it
Precompiles have no ABI and no function selector: the input is raw bytes at the exact offsets above. Call with staticcall.
// BLAKE2F at 0x09(bool ok, bytes memory out) = address(0x09).staticcall(input);require(ok, "BLAKE2F reverted");Specification
- EIP-152: Add BLAKE2 compression function F precompile