Repository navigation
feat(sha1): add midstate continuation - #71
Conversation
|
Review: hold pending the changes below. Combine this with #67/#73/#82 into a consistent midstate-continuation family. Share padding/byte-order contracts and reference vectors, with active focused metrics for each supported configuration. Historical local validation (September 11, at this unchanged PR head): Rebase on current main, address the specific gaps above, and run the affected correctness and active metric checks. Broad/full-repository runs are not requested. Reviewed commit: |
174563e to
94c819e
Compare
|
Updated and rebased on current main as commit 94c819e.\n\n- Keeps #71 as the SHA-1 member of the continuation family; it is not folded into the SHA-256 PRs.\n- Documents the exact contract: H0..H4 after one unpadded 64-byte prefix block, exactly 16 canonical byte-valued suffix items, 20 digest bytes returned, and caller-supplied prefix authentication.\n- Replaces the hand-rolled test compressor state source with the production bitcoin SHA-1 engine for the named 64-byte-0x42 fixture.\n- Adds an asymmetric prefix/suffix vector containing 0x00, 0x7f, 0x80, and 0xff, compares all 20 digest bytes, and adds strict short-input plus excess-input rejection.\n- Corrects the padding wording: SHA-1 uses a 64-bit big-endian length field containing 640 for the 80-byte message.\n- Re-measures the real-state final fragment: 205,489 locking-script bytes, 33-byte fixture witness / 49-byte canonical maximum, 632-item strict composition peak, zero hints. The fragment is unoptimized and deployment remains unclassified.\n\nValidation: affected SHA-1 tests passed; cargo test --locked --test primitive_metrics passed (106 passed, 1 ignored); python3 tools/kb.py validate passed; cargo fmt --all -- --check passed; git diff --cached --check passed. |
|
Review of The asymmetric reference vector and exact suffix boundary tests address the continuation-contract concerns. Preserve this PR's active metric test alongside current main's new hash metrics when resolving the shared test-file conflict; rerun the SHA1 midstate/padding checks and named metric test. Current integration conflicts: Validation scope: source/diff and existing CI review; no new full-repository or field-arithmetic test run was requested. |
…icts Integrates origin/main (3d1001f) into feat/sha1-midstate-boundary (94c819e) to address Robin Linus's 2026-09-25 review. Robin's conflict list named only tests/primitive_metrics.rs; the actual trial merge also conflicted on src/arithmetic/u4/mod.rs and src/hashes/sha1/mod.rs. - src/arithmetic/u4/mod.rs: both sides' `pub mod` lists were already a subset of main's, so main's file is taken as-is (verified: every PR mod line is present in main's list). - src/hashes/sha1/mod.rs: kept the PR's new sha1_80bytes_from_midstate continuation function, but adapted it to main's shared u8_reverse_toaltstack() helper (arithmetic::u32::stack) instead of restoring the PR's now-superseded local push_reverse_bytes_to_alt, per the repo convention of keeping main's refactor. - tests/primitive_metrics.rs: kept every #[test] fn and metric key from both sides (134 tests = 133 from main + 1 PR-only sha1_midstate_metrics_are_current; 934 metric keys = union of main's 931 and the PR's 802, no duplicates). All of main's hash metrics (including the new SHA-256 midstate/tagged-hash metrics) remain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed in
Nothing from Robin's comment was left undone. |
Summary
Validation
cargo test --locked hashes::sha1::tests -- --nocapturepython3 tools/kb.py validatecargo test --locked --test primitive_metricscargo fmt --checkgit diff --checkThe full repository test suite was not run.