Skip to content

BLAKE2F

Hashing

The BLAKE2b compression function F, run for a caller-specified number of rounds.

Address0x0000000000000000000000000000000000000009
NameBLAKE2F
Minimum gas0
Input213 bytes
Output64 bytes
Available sinceIstanbul

Input

rounds4 B
h64 B
m128 B
t16 B
f1 B
OffsetLengthFieldDescription
04roundsNumber of compression rounds, big-endian. This is also the gas cost.
464hState vector, 8 × 8-byte little-endian words.
68128mMessage block vector, 16 × 8-byte little-endian words.
19616tOffset counters t0, t1, little-endian.
2121fFinal 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