Skip to main content

Try it Live

Run SHA256 examples in the interactive playground
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.

SHA256 Test Vectors

Official NIST FIPS 180-4 test vectors and additional validation cases for SHA-256.

NIST FIPS 180-4 Test Vectors

Empty String

Input: "" (zero bytes) Expected Output:
Bytes:
Verification:

Single Byte “abc”

Input: "abc" (3 bytes) Expected Output:
Bytes:
Verification:

“hello world”

Input: "hello world" (11 bytes) Expected Output:
Bytes:
Verification:

448-bit Message

Input: "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" (56 bytes) This message is exactly 448 bits (56 bytes), which tests padding behavior when the message is close to a block boundary. Expected Output:
Bytes:
Verification:
This 448-bit message specifically tests SHA-256’s padding scheme. After the message, SHA-256 appends a ‘1’ bit, then zeros, then a 64-bit length field. This message length requires careful padding handling.

896-bit Message

Input: "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" (112 bytes) This 896-bit message tests multi-block processing (two 512-bit blocks). Expected Output:
Bytes:
Verification:

One Million ‘a’ Characters

Input Description

Input: 1,000,000 repetitions of the character ‘a’ This tests hashing of large inputs and validates that the implementation correctly processes multiple blocks. Expected Output:
Bytes:
Verification:
For such large inputs, consider using the streaming API for better memory efficiency:

Bitcoin-Specific Test Vectors

Genesis Block Hash

Bitcoin’s genesis block header (double SHA-256): Input: 80-byte block header (hex):
Expected Output (after double SHA-256):
Verification:

Edge Cases

Single Byte (0x00)

Input: 0x00 (1 byte of zeros) Expected Output:
Verification:

All Zeros (32 bytes)

Input: 32 bytes of zeros Expected Output:
Verification:

All Ones (32 bytes)

Input: 32 bytes of 0xFF Expected Output:
Verification:

Unicode Test Vectors

UTF-8 Emoji

Input: "🚀" (rocket emoji, 4 bytes in UTF-8: 0xF0 0x9F 0x9A 0x80) Expected Output:
Verification:

Chinese Characters

Input: "你好" (hello in Chinese, 6 bytes in UTF-8) Verification:

Streaming API Test Vectors

Chunked vs One-Shot

Verify that streaming API produces identical results to one-shot hashing:

Implementation Validation

Cross-Implementation Comparison

Compare results with well-known implementations:

See Also