Repository navigation
feat(sha256): add 80-byte midstate continuation - #67
Conversation
|
Review: hold pending the changes below. Combine this with #82 into a consistent SHA256 midstate contract, and align the broader continuation family with #71/#73. Share padding and byte-order vectors and add active focused metric checks before integration. 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: |
4a03397 to
67a1ea5
Compare
|
Consolidated and updated in commit 67a1ea5 (force-pushed to this branch).\n\n- Absorbs #82 into this PR with one SHA-256 midstate contract for both u32 and u4: a real midstate from 64 bytes of 0x42, exactly a 16-byte suffix, and the 640-bit final length.\n- Adds rejection tests for short and excess suffixes plus SHA-256 boundary vectors at 55, 56, 63, 64, 65, and 80 bytes.\n- Adds an active focused metric test covering both backends, updates the knowledge pages/catalog/comparison, and records representative versus canonical-maximum witness sizes: u32 33/49 bytes and u4 48/65 bytes.\n- Documents that the fragments consume the complete input stack and do not authenticate the supplied midstate against the prefix.\n- Validation: cargo fmt --all -- --check; python3 tools/kb.py validate; cargo test --locked --test primitive_metrics (106 passed, 1 ignored); git diff --cached --check. |
…PIs, resolve NR-064 collision Rebases the RIPEMD-160/SHA-1/SHA-256 output-prefix adapters over the SHA256 midstate-continuation and BIP340 tagged-hash APIs merged into main via solving-bitcoin#67/solving-bitcoin#68 (and the further 27-PR integration in solving-bitcoin#244). Resolves conflicts in knowledge/catalog.json, knowledge/comparisons/hashes.md, knowledge/negative-results/index.md, knowledge/primitives/sha256-u32.md, src/arithmetic/u4/mod.rs, src/hashes/ripemd160/mod.rs, src/hashes/sha1/mod.rs, src/hashes/sha256/README.md, src/hashes/sha256/sha2_u4.rs, and tests/primitive_metrics.rs by keeping both API families: main's sha256_80bytes_from_midstate/sha256_tagged_hash_32bytes plus this PR's sha256_prefix/ripemd160_prefix/sha1_prefix adapters, with matching catalog records, README rows, and primitive_metrics entries on both sides. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Summary
Validation
cargo test --locked --lib hashes::sha256::sha2_u32::testscargo test --locked --test primitive_metricspython3 tools/kb.py validatecargo fmt --checkgit diff --checkThe full repository test suite was not run; field-arithmetic tests and unrelated broad targets are outside this scoped primitive change.