Skip to content

Add adaptive sponge collision resistance over StrongURP #486

In progress

Description

@MarcIlunga

Background

How can proofs for sponge-based hash functions (SHA-3-256/384/512, Keccak-256, and custom rate/capacity parameterizations) obtain adaptive collision-resistance bounds over an ideal bidirectional permutation StrongURP with the exact literature constant C(q + 1, 2) / |C| (rather than the loose 2 q capacity set) and connect them directly to spongeHash and CC's statistical distance and substitution calculus?

Commons.Schemes.Sponge.Table provides directed partial-permutation tables and CapacityCollisionFree, Commons.Schemes.Sponge.Basic provides the parameterized byte-oriented sponge construction and input_eq_of_spongeHash_eq, and Probability.Permutation.Walk (#466) provides conditional fresh-reply event bounds for bidirectional permutation queries. Connecting these pieces into reusable adaptive games on StrongURP avoids repeating the UntilBad / StrongURP accounting per sponge scheme.

Proposed change

Add Commons.Schemes.Sponge.Collision (src/Commons/Schemes/Sponge/Collision.lean):

  1. Tight freshCapacities sharpening:
    • Define freshCapacities capacity zeroCap table := insert zeroCap (table.map fun edge => capacity edge.freshEndpoint).toFinset with freshCapacities_card_le : (freshCapacities ... table).card ≤ table.length + 1.
    • Prove capacityCollisionFree_append_of_fresh and capacityCollisionFree_insertEdge_of_fresh: avoiding freshCapacities on the newly sampled endpoint suffices to preserve CapacityCollisionFree.
  2. Reusable adaptive CapacityCollisionFree game on StrongURP:
    • Define capacityCollisionGame (p : Parameters) (q : ℕ) : TypedGame (Bidirectional (ByteState p.stateBytes) q) with capacityCollisionGame_visible : (capacityCollisionGame p q).visible = StrongURP (ByteState p.stateBytes) (q := q).
    • Prove capacityCollisionGame_win_le and capacityCollisionGame_dist_le (for p.Valid and q < Fintype.card (ByteState p.stateBytes)): every admitted winner succeeds with probability at most (|S| / (|S| - q)) · C(q + 1, 2) / |C|.
  3. Combined adaptive capacity + digest collision game and spongeHash collision resistance:
    • Define spongeCollisionGame (p : Parameters) (q : ℕ) : TypedGame (Bidirectional (ByteState p.stateBytes) q) monitoring both CapacityCollisionFree and Set.InjOn (digestPart p) (forwardOutputs table), with spongeCollisionGame_visible = StrongURP ....
    • Prove spongeCollisionGame_win_le: every admitted winner succeeds with probability at most (|S| / (|S| - q)) · (C(q + 1, 2) / |C| + C(q, 2) / |O|).
    • Prove spongeCollisionGame_unset_no_collision (on any unset transcript, no two distinct covered inputs collide under spongeHash), plus CC-level corollaries spongeCollisionGame_dist_le (Δ), spongeCollisionGame_attach_dist_le (Δ, •), and spongeCollisionGame_substitutesWithin (≃[...]).

Acceptance criteria

  • Tests.SpongeCollision verifies:
    • Strict tightening of freshCapacities over occupiedCapacities via a concrete Fin 4 example where a new forward output coincides with an earlier forward edge's input.
    • Concrete instantiations of capacityCollisionGame_win_le and spongeCollisionGame_win_le on a 4-byte sponge (q = 3) and on sha3_256, sha3_384, and sha3_512.
    • Unset-transcript collision-freeness of spongeHash sha3_256 (spongeCollisionGame_unset_no_collision).
    • cc_normalize, cc_calc statistical, and ≃[...] compatibility under CC custom notation (Δ, •, ≫, |≡, ≃[...]).
    • #print axioms on key exported theorems confirming dependence only on propext, Classical.choice, and Quot.sound.
  • lake build --wfail, scripts/check-sources.sh, scripts/check-axioms.sh, and lake env lean -Dweak.linter.mathlibStandardSet=true pass with zero warnings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions