[Repo Assist] test: add NIST FIPS 180-4 SHA-256 test vectors#148
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
[Repo Assist] test: add NIST FIPS 180-4 SHA-256 test vectors#148github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
Add three additional SHA-256 test vectors from NIST FIPS 180-4:
- 56-byte input crossing the SHA-256 padding boundary
("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
Expected: 248d6a61...db06c1
- 112-byte input spanning two full 512-bit blocks
("abcdefghbcdefghicdefghij...")
Expected: cf5b16a7...fee9d1
- 1,000,000 'a' characters via incremental API
Expected: cdc76e5c...112cd0
These exercise the padding boundary, multi-block processing, and
the incremental l_sha256_init/l_sha256_update/l_sha256_final API
with large inputs. All 32 bytes of each expected hash are verified
via l_memcmp.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Adds three additional SHA-256 test vectors from NIST FIPS 180-4 to
tests/test_utils.c, strengthening confidence in the correctness of the freestanding SHA-256 implementation across all input sizes.Changes
````tests/test_utils.c``` — extended
test_sha256()with:56-byte padding-boundary vector —
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"(56 bytes), which crosses the SHA-256 padding boundary (pad block needed). Expected:248d6a61...db06c1112-byte two-block vector —
"abcdefghbcdefghicdefghij..."(112 bytes), two full 512-bit processing blocks. Expected:cf5b16a7...fee9d11,000,000 × 'a' via incremental API — 1000 calls of 1000 bytes each to
l_sha256_update, exercisingl_sha256_init / l_sha256_update / l_sha256_finalwith a very large input. Expected:cdc76e5c...2cd0All 32 bytes of each expected hash are verified via
l_memcmp.Motivation
The existing tests only covered the empty string and
"abc"(both fit in a single 512-bit block). These new vectors exercise:Test Status
✅ All tests pass on Linux x86_64 (gcc):
Full
./Taskfile testsuite passes.