Skip to content

SHA3: Explicitly name the underlying Keccak instance - #360

Merged
marsella merged 1 commit into
masterfrom
glguy/sha3-submodule
Sep 8, 2026
Merged

SHA3: Explicitly name the underlying Keccak instance#360
marsella merged 1 commit into
masterfrom
glguy/sha3-submodule

Conversation

@glguy

@glguy glguy commented Sep 5, 2026

Copy link
Copy Markdown
Member

This enables external verification in to access the underlying Keccak primitives as used in a SHA3 instantiation. In particular this support compositional verification activities against refined specifications.

This enables external verification in to access the underlying
Keccak primitives as used in a SHA3 instantiation. In particular
this support compositional verification activities against
refined specifications.

@glguy glguy left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows me to relate internal functions of the the cryptol-specs version of SHA3 to my refined one which allows efficient compositional verification. Here's an example of what that looks like:

thm_pi <- prove_pretty "π equivalent"
    rme
    {{ Spec::pi === Ref::Keccak::π }};

for [0, 1, 20, 81, 1024, 1025] (\N ->
    prove_pretty (str_concat "Reference equivalent " (show N))
        do {
            goal_eval_unint ["Spec::pi", "Ref::Keccak::π"];
            simplify (addsimp thm_pi empty_ss);
            w4_unint_rme ["Ref::Keccak::π"];
        }
        {{ Spec::hash`{N} === Ref::hash }}
);
π equivalent
Time: 0.004215s

OK
Reference equivalent 0
Starting RME
Time: 2.228779s

OK
Reference equivalent 1
Starting RME
Time: 2.297238s

OK
Reference equivalent 20
Starting RME
Time: 2.341336s

OK
Reference equivalent 81
Starting RME
Time: 2.46238s

OK
Reference equivalent 1024
Starting RME
Time: 4.893666s

OK
Reference equivalent 1025
Starting RME
Time: 4.884365s

@glguy

glguy commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

This pattern would also be relevant in: AES_GCM_SIV, SHAKE128, and SHAKE256

@marsella marsella left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this change. Do you want me to rewrite the others similarly?

@marsella

marsella commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

I'm merging despite CI failures because I do not think those are related.

@marsella
marsella merged commit 138fd3e into master Sep 8, 2026
2 of 6 checks passed
@marsella
marsella deleted the glguy/sha3-submodule branch September 8, 2026 18:39
@glguy

glguy commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

I'm fine with this change. Do you want me to rewrite the others similarly?

I think it's probably a good practice to always name these imports; I just didn't want to make the change any harder to get merged than necessary.

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.

2 participants