-
Notifications
You must be signed in to change notification settings - Fork 262
Update to ExpandMsg changes
#1203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Contributor
Author
|
I see some crates still require updating to the new |
Member
5bd2c69 to
0568843
Compare
Contributor
Author
|
Broken until #1206 is in. |
tarcieri
pushed a commit
to RustCrypto/traits
that referenced
this pull request
May 28, 2025
## Changes to `ExpandMsg` - Move generic parameter `K` from `ExpandMsg` implementers to `trait ExpandMsg` itself. This was necessary to be able to enforce the correct `K` instead of letting users insert an arbitrary one. E.g. `GroupDigest::hash_from_bytes()` can now `where X: ExpandMsg<Self::K>` instead of users calling `hash_from_bytes::<ExpandMsgXmd<Sha256, U0>>()`. However, this made calling `ExpandMsg` implementers directly more difficult. E.g. instead of `ExpandMsgXmd::<Sha256, U32>::expand_msg(...)` users now have to write `<ExpandMsgXmd<Sha256> as ExpandMsg<U32>>::expand_message()`. If we want to address this, I propose adding `RawExpandMsgXmd`. - Add `CollisionResistance` requirement to `ExpandMsgXof`. - Move the lifetime on `ExpandMsg` to the associated `type Expander<'dst>`. - Fix `dst` not actually being checked to be empty, but instead checked for number of slices. - Move `GroupDigest`s `ProjectivePoint: CofactorGroup` bound to super trait bounds. This makes it less "poisoning" so downstream users don't have to write `where ProjectivePoint: CofactorGroup` every time they use `GroupDigest`. - Move `GroupDigest::hash_to_scalar()`s `Scalar: FromOkm` bounds to `GroupDigest`. I believe this was a historical leftover when `FromOkm` wasn't implemented for `Scalar`s yet. - Improved some documentation around hash2curve and updated all mentions of the draft to RFC9380. - Rename parameter names `msgs` and `dsts` to singular `msg` and `dst`. 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 `GroupDigest` to the `Dev` curve. ## 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): - Renamed all mentions of VOPRF to OPRF. VOPRF was the old name of the draft when it was just a single "mode", the RFC is split into three modes: OPRF, VOPRF and POPRF. The RFC itself is called ["Oblivious Pseudorandom Functions (OPRFs)"](https://www.rfc-editor.org/rfc/rfc9497.html). - Changed associated `const ID` from `&str` to `&[u8]`. - Changed associated `type Hash` from requiring `Digest` to `Default + FixedOutput + Update`. - Updated all mentions of the VOPRF draft to RFC9497. --- Related: RustCrypto/hashes#694. Companion PR: RustCrypto/elliptic-curves#1203.
Member
|
@daxpedda can you update this please? |
Contributor
Author
|
Done. |
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.
Updates to the changes introduced in RustCrypto/traits#1862.
Requires RustCrypto/traits#1862.