[z3-verifier] Formal verification of SHA-256 against FIPS 180-4#1386
Draft
0xAndoroid wants to merge 1 commit intomainfrom
Draft
[z3-verifier] Formal verification of SHA-256 against FIPS 180-4#13860xAndoroid wants to merge 1 commit intomainfrom
0xAndoroid wants to merge 1 commit intomainfrom
Conversation
Verify the Jolt SHA-256 inline implementation using Z3 bit-vector theory. Properties proven for all 32-bit inputs: - K[] and H[] constants match FIPS 180-4 §4.2.2 / §5.3.3 - Optimized Ch (ANDN-based) ≡ spec Ch(x,y,z) = (x∧y)⊕(¬x∧z) - Optimized Maj ((B&C)⊕(A&(B⊕C))) ≡ spec Maj - Σ₀, Σ₁, σ₀, σ₁ decompositions match spec - Message schedule W expansion is correct - Single-round T1/T2/state-update matches spec - Z3 spec model produces correct NIST test vector outputs - exec.rs compression matches NIST vectors (3 concrete tests) - execute_sha256_compression_initial uses correct FIPS IV Full 64-round symbolic equivalence is available as an ignored test for manual runs (too slow for CI).
50b8396 to
4d449ed
Compare
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 is an experiment. Ignore it for now
Summary
(B&C)^(A&(B^C))Maj) for all 32-bit inputsWhat is verified
(E&F)^(G&~E)≡(x∧y)⊕(¬x∧z)(B&C)^(A&(B^C))≡(x∧y)⊕(x∧z)⊕(y∧z)Test plan
cargo nextest run -p z3-verifier -E 'test(sha256)'— 15/15 passcargo clippy -p z3-verifier -- -D warnings— cleancargo fmt -- --check— cleanlibz3(brew install z3 pkg-configon macOS)