Skip to main content
Blake2 (also exported as Blake2Hash) computes RFC 7693 BLAKE2b digests of configurable length (1 to 64 bytes, default 64) backed by @noble/hashes/blake2.js, and exports the raw EIP-152 compress function used by EVM precompile 0x09 (BLAKE2F).

Pipeline and EIP-152 Compression Layout

Quick Start

API Reference

EIP-152 compress Input Layout (213 Bytes)

compress matches the EVM BLAKE2F precompile (0x09) byte-for-byte:

Errors and Edge Cases

  • outputLength outside 1..64 throws Blake2InvalidOutputLengthError.
  • compress throws Blake2InvalidInputLengthError if input.length !== 213 and Blake2Error if the final flag f is neither 0 nor 1.
  • Unlike SHA-256, BLAKE2b is immune to length-extension attacks.
  • For WASM execution, import Blake2Wasm from @tevm/voltaire/wasm.

Test Vectors