Skip to content

test(repeat): blob_hash vectors at SHA-1 padding boundaries - #39

Merged
HackPoint merged 1 commit into
mainfrom
agents/blob-hash-padding-vectors
Oct 11, 2026
Merged

HackPoint merged 1 commit into
mainfrom
agents/blob-hash-padding-vectors

Conversation

@HackPoint

Copy link
Copy Markdown
Owner

What

Test-only. Adds git hash-object vectors for blob_hash at total lengths (the blob N\0 header plus content) of 55, 56, 63, 64, 119 and 120 bytes, keyed by total length with the content length derived from it. Also adds a CRLF/LF pair that must equal git's hash of the LF form (1b39008c...).

Why

Hand-written SHA-1 padding is where implementations typically break (55/56, 63/64, 119/120). Not a bug today; this stops a refactor breaking it unnoticed. The existing sha1_handles_block_boundaries is keyed by content length, so totals 55, 56, 119 and 120 were not covered. Expected values come from running git hash-object --stdin on the exact bytes.

Meaningful?

Locally broke the padding three ways (0x80 to 0x81, pad target 56 to 55, length word *8 to *7). The new test went red each time (first failure at total 55). All reverted; the diff touches only the test module.

Left alone

The hand-written SHA-1 is not replaced with the sha1 crate and no dependency was added; that is the owner's call.

Local CI

Closes #34

…LF/LF pair against git

git hash-object vectors at total lengths (blob header plus content) of 55, 56, 63, 64, 119 and 120 bytes, where hand-written SHA-1 padding typically breaks, and a CRLF/LF pair that must equal git's hash of the LF form. Test-only.
@HackPoint
HackPoint merged commit 8ea569a into main Oct 11, 2026
17 checks passed
@HackPoint
HackPoint deleted the agents/blob-hash-padding-vectors branch October 11, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

blob_hash: add padding-boundary test vectors

1 participant