Merged
Conversation
7b221e2 to
9df328e
Compare
9df328e to
5c1b97f
Compare
Contributor
Author
|
Cc @mikelodder7. |
newpavlov
pushed a commit
to RustCrypto/hashes
that referenced
this pull request
May 28, 2025
This PR implements `CollisionResistance` for all XOFs. I started with those to add support for `ExpandMsgXof` in `elliptic-curve` and will do follow-up PRs for at least SHA2 and SHA3 fixed output hashes. Companion PR: RustCrypto/traits#1862. See RustCrypto/traits#1816 for previous discussions.
5c1b97f to
fac0af9
Compare
Contributor
|
Looks good to me. I was just preparing a PR to address #1146 which would remove the |
Contributor
|
This LGTM. I like the approach to remove the |
Contributor
Author
Feel free to do your thing, I'm happy to rebase. |
fac0af9 to
d11b3be
Compare
tarcieri
approved these changes
May 28, 2025
sebastinas
pushed a commit
to sebastinas/ascon-aead
that referenced
this pull request
Nov 3, 2025
This PR implements `CollisionResistance` for all XOFs. I started with those to add support for `ExpandMsgXof` in `elliptic-curve` and will do follow-up PRs for at least SHA2 and SHA3 fixed output hashes. Companion PR: RustCrypto/traits#1862. See RustCrypto/traits#1816 for previous discussions.
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.
Changes to
ExpandMsgMove generic parameter
KfromExpandMsgimplementers totrait ExpandMsgitself. This was necessary to be able to enforce the correctKinstead of letting users insert an arbitrary one. E.g.GroupDigest::hash_from_bytes()can nowwhere X: ExpandMsg<Self::K>instead of users callinghash_from_bytes::<ExpandMsgXmd<Sha256, U0>>().However, this made calling
ExpandMsgimplementers directly more difficult. E.g. instead ofExpandMsgXmd::<Sha256, U32>::expand_msg(...)users now have to write<ExpandMsgXmd<Sha256> as ExpandMsg<U32>>::expand_message(). If we want to address this, I propose addingRawExpandMsgXmd.Add
CollisionResistancerequirement toExpandMsgXof.Move the lifetime on
ExpandMsgto the associatedtype Expander<'dst>.Fix
dstnot actually being checked to be empty, but instead checked for number of slices.Move
GroupDigestsProjectivePoint: CofactorGroupbound to super trait bounds. This makes it less "poisoning" so downstream users don't have to writewhere ProjectivePoint: CofactorGroupevery time they useGroupDigest.Move
GroupDigest::hash_to_scalar()sScalar: FromOkmbounds toGroupDigest. I believe this was a historical leftover whenFromOkmwasn't implemented forScalars yet.Improved some documentation around hash2curve and updated all mentions of the draft to RFC9380.
Rename parameter names
msgsanddststo singularmsganddst. This is to avoid confusion: even though the type is&[&[u8]], it doesn't represent multiple messages or DSTs, but single concated ones.Remove non-functioning examples. While I don't think the examples are necessary, I'm happy to re-add them if desired, but I would have to add
GroupDigestto theDevcurve.Changes to VOPRF
While I was at it, I also adjusted a couple of things around
VoprfParameters(but I'm happy to split this into its own PR):const IDfrom&strto&[u8].type Hashfrom requiringDigesttoDefault + FixedOutput + Update.Related: RustCrypto/hashes#694.
Companion PR: RustCrypto/elliptic-curves#1203.