SHA-224 Validation & Test Vectors

Comprehensive resources for validating your SHA-224 implementations against official standards and test vectors.

Introduction to SHA-224 Validation

Proper validation is crucial for cryptographic algorithms like SHA-224. Implementation errors, even small ones, can completely undermine security. This page provides tools, test vectors, and guidance to ensure your SHA-224 implementation is correct and compliant with FIPS 180-4 standards.

Official Test Vectors

NIST-provided test cases with expected outputs for validating implementation correctness across various inputs.

Online Validation Tool

Interactive tools to verify your SHA-224 implementation against known good results in real-time.

Edge Case Testing

Special test cases to verify correct handling of empty inputs, large inputs, and unusual data patterns.

Compliance Checklist

Comprehensive guidance on ensuring your implementation meets all FIPS 180-4 requirements.

Online SHA-224 Validation Tool

Use this tool to verify your own SHA-224 implementations. Enter your input and the hash value you've calculated, and we'll verify it against our reference implementation.

Official SHA-224 Test Vectors

The following test vectors are derived from the official NIST Cryptographic Algorithm Validation Program (CAVP) and FIPS 180-4 documentation. These are critical for validating your SHA-224 implementation.

Basic Test Vectors

Input (ASCII) Input (Hex) Expected SHA-224 Hash (Hex)
""
(empty string)
"" d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f
"abc" 616263 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 6162636462636465636465666465666765666768666768696768696a68696a6b696a6b6c6a6b6c6d6b6c6d6e6c6d6e6f6d6e6f706e6f7071 75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525
"The quick brown fox jumps over the lazy dog" 54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f67 730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525
"The quick brown fox jumps over the lazy dog." 54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f672e 619cba8e8e05826e9b8c519c0a5c68f4fb653e8a3d8aa04bb2c8cd4c

Million-'a' Test Vector

This test vector consists of the character 'a' (ASCII value 97 or hex 0x61) repeated 1,000,000 times.

Input Description Expected SHA-224 Hash (Hex)
"a" repeated 1,000,000 times (0x61 repeated 1,000,000 times) 20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67

Edge Case Test Vectors

Description Input (Hex) Expected SHA-224 Hash (Hex)
Single zero byte 00 fff9292b4201617bdc4d3053fce02734166a683d7d858a70beccd7a7
Single one byte ff e33f9d75e6ae1369dbabf81b96b4591ae46bba30b591a6b6c62542b5
448 bits (56 bytes) - block boundary edge case 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff0011223344556677 a7a0b8a982fabdfd428f8f25bcda7e440f4e125e67104a15446494e2
504 bits (63 bytes) - one byte short of block boundary 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00 77bf2c4f541ac81246ccb173d73b1e42fe0ca65e5e77c664ba6dfaec
512 bits (64 bytes) - exact block boundary 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff 4b8ce33e68161b2efcbf7cb4bbd6de4caa4c7d9c8e90ca5cc87eb03f

Multi-byte Character Test Vectors

Input (UTF-8) Input (Hex) Expected SHA-224 Hash (Hex)
"中文"
(Chinese)
e4b8ade69687 cc47772044c7a6914c8820b3cba4484bd53c3c8ddc6220f12da58be7
"ñáéíóú"
(Spanish)
c3b1c3a1c3a9c3adc3b3c3ba e9864bb53694d2ad2ffbd40eb915c9b6a331fa6c69a66f9bad9c789e
"こんにちは"
(Japanese)
e38193e38293e381abe381a1e381af fcc6da1107b7f8a6ddcc9dcc090fc09ef283041e6abf507f93d88aae
"😀🔒🌍"
(Emoji)
f09f9880f09f9492f09f8c8d 10e57f1a1d98f6f43449f83cd5aec42b12a7eaf5b3a1e693a773e392

Important Note on Character Encoding

When hashing string data, it's crucial to explicitly specify the encoding used (typically UTF-8). Different encodings will produce different byte sequences from the same string, resulting in different hash values. All string test vectors on this page assume UTF-8 encoding.

Custom Test Vector Generator

Generate custom test vectors for specific testing scenarios with this tool.

SHA-224 Implementation Compliance Checklist

Use this checklist to ensure your SHA-224 implementation meets all the requirements of the FIPS 180-4 standard:

Message Padding

  • Append a single '1' bit to the message
  • Append '0' bits until the resulting length in bits is congruent to 448 modulo 512
  • Append the length of the original message as a 64-bit big-endian integer
  • Handle edge cases like empty messages correctly
  • Handle messages at or near block boundaries correctly

Initial Hash Values

  • Use correct SHA-224 initial hash values (different from SHA-256)
  • H[0] = 0xc1059ed8
  • H[1] = 0x367cd507
  • H[2] = 0x3070dd17
  • H[3] = 0xf70e5939
  • H[4] = 0xffc00b31
  • H[5] = 0x68581511
  • H[6] = 0x64f98fa7
  • H[7] = 0xbefa4fa4

Endianness Handling

  • Process data in big-endian format (network byte order)
  • Handle conversions correctly on little-endian platforms
  • Correctly interpret multi-byte values in the message schedule
  • Output hash in correct byte order

Constants and Functions

  • Use all 64 round constants defined in FIPS 180-4
  • Implement all six logical functions correctly
  • Ch(x,y,z) = (x AND y) XOR ((NOT x) AND z)
  • Maj(x,y,z) = (x AND y) XOR (x AND z) XOR (y AND z)
  • ROTR(n,x) = (x >>> n) OR (x << (32-n))
  • Σ0(x) = ROTR(2,x) XOR ROTR(13,x) XOR ROTR(22,x)
  • Σ1(x) = ROTR(6,x) XOR ROTR(11,x) XOR ROTR(25,x)
  • σ0(x) = ROTR(7,x) XOR ROTR(18,x) XOR (x >>> 3)
  • σ1(x) = ROTR(17,x) XOR ROTR(19,x) XOR (x >>> 10)

Message Schedule

  • Correctly prepare first 16 words from message block
  • Correctly extend to remaining 48 words using the message schedule formula
  • Handle 32-bit word operations with proper overflow behavior

Processing Loop

  • Initialize working variables a through h with current hash values
  • Perform all 64 rounds of processing correctly
  • Update hash values after processing each block

Output Handling

  • Return only the first 7 words (224 bits) of the final hash state
  • Convert output to hexadecimal in correct order
  • Handle output encoding consistently

Edge Cases

  • Handle messages of all sizes correctly, including:
  • Empty message
  • Small messages (less than one block)
  • Messages exactly one block in length
  • Messages crossing block boundaries
  • Very large messages (if applicable)

Additional Validation Resources

NIST CAVP

The Cryptographic Algorithm Validation Program provides comprehensive test vectors and validation tools for SHA-224 and other algorithms.

Visit CAVP

FIPS 180-4 Standard

The official NIST standard that defines SHA-224 and other secure hash algorithms in the SHA-2 family.

Download PDF

Cryptographic Test Vectors

A collection of test vectors for various cryptographic algorithms, including extended SHA-224 test cases.

View Repository

Implementation Guidelines

Best practices and guidelines for implementing cryptographic hash functions securely and efficiently.

Read Guidelines

Validation FAQs

Why is validation important for hash function implementations?

Cryptographic hash functions like SHA-224 must be implemented precisely according to specification. Even small errors can completely undermine security properties. Validation ensures your implementation is correct and will interoperate with other systems.

My implementation fails on some test vectors but passes on others. What should I check?

Common issues include: incorrect endianness handling, errors in message padding (especially at block boundaries), incorrect handling of 32-bit arithmetic (missing modulo operations), or using SHA-256 initial values instead of SHA-224 values. Pay special attention to the size of failing vectors to help identify where the issue might be.

Do I need to validate my implementation if I'm using a standard library?

While standard libraries are generally well-tested, it's still good practice to validate them against known test vectors, especially if you're using them in security-critical applications. This also helps verify that you're using the library correctly.

What's the difference between validation and FIPS certification?

Validation refers to testing an implementation against known test vectors to ensure correctness. FIPS certification is a formal process conducted by accredited laboratories to certify that an implementation meets all FIPS requirements, including correct operation, documentation, and security protections.

Can I use SHA-224 in my FIPS 140-2/140-3 compliant application?

Yes, SHA-224 is specified in FIPS 180-4 and is an approved algorithm for use in FIPS 140 compliant modules. However, your specific implementation must be validated as part of your overall FIPS validation process.

How can I test the performance of my SHA-224 implementation?

Use the million-'a' test vector as a standardized performance test. Measure how long it takes to hash 1,000,000 'a' characters. Compare against other implementations on the same hardware for relative performance metrics.