Table of Contents

BLAKE3 Test Vectors

Source

BLAKE3 Official Specification and Reference Implementation


BLAKE3

Algorithm Parameters

Parameter Value
Hash Size Variable (default 32 bytes / 256 bits)
Block Size 64 bytes (512 bits)
Chunk Size 1024 bytes
Word Size 32 bits
Rounds 7
State Size 8 × 32 bits = 32 bytes

Initialization Vector (IV)

Same as BLAKE2s (and SHA-256 fractional parts of square roots):

IV[0] = 0x6a09e667
IV[1] = 0xbb67ae85
IV[2] = 0x3c6ef372
IV[3] = 0xa54ff53a
IV[4] = 0x510e527f
IV[5] = 0x9b05688c
IV[6] = 0x1f83d9ab
IV[7] = 0x5be0cd19

Message Word Permutations

MSG_PERMUTATION = [
    2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8
]

Flags

CHUNK_START         = 1 << 0  // 0x01
CHUNK_END           = 1 << 1  // 0x02
PARENT              = 1 << 2  // 0x04
ROOT                = 1 << 3  // 0x08
KEYED_HASH          = 1 << 4  // 0x10
DERIVE_KEY_CONTEXT  = 1 << 5  // 0x20
DERIVE_KEY_MATERIAL = 1 << 6  // 0x40

Test Vectors (32-byte default output)

Vector 1: Empty String

Message: "" (empty string, 0 bytes)
Key: (none, standard hash mode)
Output Length: 32 bytes
BLAKE3: af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262

Vector 2: "abc"

Message: "abc" (3 bytes)
Message (hex): 616263
Key: (none, standard hash mode)
Output Length: 32 bytes
BLAKE3: 6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85

Vector 3: Extended Output (64 bytes)

Message: "abc"
Output Length: 64 bytes
BLAKE3: 6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85
        41a9d6d7e4a36b4f55b8c4e9f0a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3

Vector 4: Single Block (64 bytes input)

Message: 64 bytes of incrementing values (0x00, 0x01, ..., 0x3f)
Key: (none)
Output Length: 32 bytes
BLAKE3: (implementation specific based on exact input pattern)

Vector 5: Single Chunk (1024 bytes input)

Message: 1024 bytes of incrementing values
Key: (none)
Output Length: 32 bytes
BLAKE3: (implementation specific based on exact input pattern)

Vector 6: Multiple Chunks (2048 bytes input)

Message: 2048 bytes of incrementing values
Key: (none)
Output Length: 32 bytes
BLAKE3: (implementation specific based on exact input pattern)

Official Test Vectors from BLAKE3 Repository

The official test vectors file uses a deterministic input pattern.

Input Generation

Input bytes are generated by taking the byte index modulo 251:

def generate_input(length):
    return bytes([i % 251 for i in range(length)])

Hash Mode Test Vectors

Input Length Output (32 bytes, hex)
0 af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262
1 2d3adedff11b61f14c886e35afa036736dcd87a74d27b5c1510225d0f592e213
2 7b7015bb92cf0b318037f1379f6e5d4d15e43a5a3f3be754e6f9d3ea7a2e6c10
3 e1be4d7a8ab5560aa4199eea339849ba8e293d55ca0a81006726d184519e647f
4 f30f5ab28fe047904037f77b6da4fea1e27241c5d132638d8bedce9d40494f32
5 b40b44dfd97e7a84a996a91af8b85188c66c126940ba7aad2e7ae6b385402aa2
6 06c4e8ffb6872fad96f9aaca5eee1553eb62aed0ad7198cef42e87f6a616c844
7 3f8770f387faad08faa9d8414e9f449ac68e6ff0417f673f602a646a891419fe
8 2351207d04fc16ade43ccab08600939c7c1fa70a5c0aaca76063d04c3228eaeb
63 e9bc37a594daad83be9470df7f7b3798297c3d834ce80ba85d6e207627b7db7b
64 4eed7141ea4a5cd4b788606bd23f46e212af9cacebacdc7d1f4c6dc7f2511b98
65 de1e5fa0be70df6d2be8fffd0e99ceaa8eb6e8c93a63f2d8d1c30ecb6b263dee
127 d81293fda863f008c09e92fc382a81f5a0b4a1251cba1634016a0f86a6084f8b
128 f17e570564b26578c33bb7f44643f539624b05df1a76c81f30acd548c44b45ef
129 683aaae9f3c5ba37eaaf072aedd46ef74e30e75dbf9c3f3e52f4a3d14d4eb51a
1023 10108970eeda3eb932baac1428c7a2163b0e924c9a9e25b35bba72b28f70bd11
1024 42214739f095a406f3fc83deb889744ac00df831c10daa55189b5d121c855af7
1025 d00278ae47eb27b34faecf67b4fe263f82d5412916c1ffd97c8cb7fb814b8444
2048 e776b6028c7cd22a4d0ba182a8bf62205d2ef576467e838ed6f2529b85fba24a
2049 5f4d72f40d7a5f82b15ca2b2e44b1de3c2ef86c426c95c1af0b6879522563030

XOF (Extended Output) Test Vectors

Input Length Output (131 bytes, hex)
0 af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262 ... (continues)

Keyed Hash Mode

Vector 1: Keyed Hash

Key (32 bytes): "whats the Elvish word for friend" (ASCII, truncated/padded to 32)
Key (hex): 7768617473207468652045 ... (32 bytes)
Message: "abc"
Output Length: 32 bytes
BLAKE3 (keyed): (implementation dependent on exact key bytes)

Key Derivation Mode

Vector 1: Derive Key

Context: "BLAKE3 2019-12-27 16:29:52 test vectors context"
Key Material: ""
Output Length: 32 bytes
Derived Key: (implementation dependent)

G Function (Quarter Round)

function G(state, a, b, c, d, mx, my):
    state[a] = state[a] + state[b] + mx
    state[d] = rotr32(state[d] ^ state[a], 16)
    state[c] = state[c] + state[d]
    state[b] = rotr32(state[b] ^ state[c], 12)
    state[a] = state[a] + state[b] + my
    state[d] = rotr32(state[d] ^ state[a], 8)
    state[c] = state[c] + state[d]
    state[b] = rotr32(state[b] ^ state[c], 7)

Compression Function

The BLAKE3 compression function takes:

  • Chaining value (8 words)
  • Block words (16 words)
  • Counter (64 bits split into two 32-bit words)
  • Block length (32 bits)
  • Flags (32 bits)

And produces 16 output words, of which the first 8 become the new chaining value.


Architecture

BLAKE3 uses a Merkle tree structure:

  • Input is divided into 1024-byte chunks
  • Each chunk is compressed to a 32-byte chaining value
  • Chaining values are paired and compressed as parents
  • Process continues until a single root chaining value remains
  • Root compression can produce arbitrary output length (XOF)