Little endianness serialization method #156
Open
TalDerei wants to merge 1 commit into
Open
Conversation
Merged
Contributor
|
This is what we did in RustCrypto#10 but I was hoping there was a more elegant solution |
str4d
reviewed
May 28, 2026
Comment on lines
+296
to
+298
| /// The default implementation assumes [`Self::to_repr`] already returns a little-endian | ||
| /// encoding. Implementors whose [`Self::to_repr`] uses big-endian encoding must override | ||
| /// this method (e.g. by reversing the bytes). |
Member
There was a problem hiding this comment.
This is a bad assumption to include in a root trait's default method, because downstream trait implementers will not be aware that they need to override it.
str4d
reviewed
May 28, 2026
| /// The default implementation assumes [`Self::to_repr`] already returns a little-endian | ||
| /// encoding. Implementors whose [`Self::to_repr`] uses big-endian encoding must override | ||
| /// this method (e.g. by reversing the bytes). | ||
| fn to_le_repr(&self) -> Self::Repr { |
Member
There was a problem hiding this comment.
This cannot return Self::Repr, because this is not guaranteed to be round-trip compatible with Self::from_repr.
str4d
requested changes
May 28, 2026
Member
There was a problem hiding this comment.
NACK for reasons in my comments and in #155 (comment).
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.
References #155 (comment) and pairs with zkcrypto/group#81. Adds a second
to_le_reprserialization onPrimeFieldas a provided trait method.