[DO NOT MERGE YET] feat(hashing): Add domain separation in merkle#962
Open
iamrecursion wants to merge 1 commit intonextfrom
Open
[DO NOT MERGE YET] feat(hashing): Add domain separation in merkle#962iamrecursion wants to merge 1 commit intonextfrom
iamrecursion wants to merge 1 commit intonextfrom
Conversation
fab271b to
ea626fa
Compare
ea626fa to
2158994
Compare
db68126 to
fb7150b
Compare
Contributor
|
I would probably split out introduction of the |
fb7150b to
3adec7d
Compare
Collaborator
Author
|
I've opened #978 to encompass just those changes, which this is now rebased on top of. |
3adec7d to
bd79f3b
Compare
4d2d73b to
f5702d4
Compare
bd79f3b to
c0e4e4d
Compare
f5702d4 to
c701b3d
Compare
c0e4e4d to
5d1cfe3
Compare
This commit adds `Poseidon2::hash_elements_in_domain` to allow domain-tagging of hash inputs. This new function is then used in the hashing procedure for `SmtLeaf`, providing domain separation for any client of that type. Affected downstream data types include `Smt`, `LargeSmt`, and `LargeSmtForest`, all of which use that type. Note that THIS REQUIRES CHANGES TO THE CORELIB, as without the procedural changes, the clients of the API and of the VM will get different results.
5d1cfe3 to
cbab633
Compare
huitseeker
approved these changes
Apr 21, 2026
Collaborator
huitseeker
left a comment
There was a problem hiding this comment.
This LGTM!
VM-side changes need not be concurrent, if this is included in a major release (see inline nit)
| - [BREAKING] Split the `SecretKey` type for both ECDSA-k256 and EdDSA-25519 into `SigningKey` and `KeyExchangeKey` to help enforce better practices around key reuse. `SecretKey` is no longer available in the public API; all usages should be moved to one of the new key types ([#965](https://github.com/0xMiden/crypto/pull/965)). | ||
| - Reduce repeated history scans in historical `LargeSmtForest::open()` queries ([#971](https://github.com/0xMiden/crypto/pull/971)). | ||
| - Added domain-separated hashing support for elements to `AlgebraicSpoonge` as `hash_elements_in_domain(...)`. | ||
| - [BREAKING] Changed `SmtLeaf::hash` to perform domain-separated hashing, reducing the risk of a collision with the hash of an inner node. Miden VM **must** be updated to comply with this. |
Collaborator
There was a problem hiding this comment.
Nit: given the breaking nature (and that 0.24 is released) I'd push this in the 0.25 tree.
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.
Describe your changes
This commit adds
Poseidon2::hash_elements_in_domainto allow domain-tagging of hash inputs. This new function is then used in the hashing procedure forSmtLeaf, providing domain separation for any client of that type.Affected downstream data types include
Smt,LargeSmt, andLargeSmtForest, all of which use that type.Note that THIS REQUIRES CHANGES TO THE VM'S CORELIB, as without the procedural changes, the clients of the API and of the VM will get different results.
Closes #860. Filed VM-side issue as 0xMiden/miden-vm#2996.
Checklist before requesting a review
nextaccording to naming convention.