SHA3: Explicitly name the underlying Keccak instance - #360
Merged
Conversation
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
commented
Sep 5, 2026
glguy
left a comment
Member
Author
There was a problem hiding this comment.
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
Member
Author
|
This pattern would also be relevant in: AES_GCM_SIV, SHAKE128, and SHAKE256 |
marsella
approved these changes
Sep 8, 2026
marsella
left a comment
Contributor
There was a problem hiding this comment.
I'm fine with this change. Do you want me to rewrite the others similarly?
Contributor
|
I'm merging despite CI failures because I do not think those are related. |
Member
Author
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. |
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 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.