-
Notifications
You must be signed in to change notification settings - Fork 561
ff FieldElement #787
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
Open
kayabaNerve
wants to merge
11
commits into
dalek-cryptography:main
Choose a base branch
from
kayabaNerve:ff-fieldelement
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ff FieldElement #787
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
205c797
Add support for the ff/group API to FieldElement
kayabaNerve 3f174ca
Publicize FieldElement, with a note it's not covered by semver and ma…
kayabaNerve 6ac3776
Add support for PrimeFieldBits
kayabaNerve 6860d51
Add a dedicated FieldElement type which is safe to expose
kayabaNerve 54e5768
cargo +nightly fmt
kayabaNerve 997d7c7
Use negate instead of subtraction from zero
kayabaNerve 1537414
Add Zeroize to FfFieldElement
kayabaNerve cb79892
Update README respective to the exposed FieldElement type
kayabaNerve 2f5c749
Fix exporting of the new FieldElement type
kayabaNerve c703a9e
clippy
kayabaNerve bc85a42
FromUniformBytes<64> for FfFieldElement
kayabaNerve File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about adding another field element type, especially with a name like
FfFieldElement
(Finite field field element?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a thin wrapper around the existing FieldElement into the ff backend. It's exported publicly as FieldElement, but as it's a distinct type, it obviously needed its own name internally. The alternative would be this in its own module (as now), with the underlying FieldElement imported under the alias UnderlyingFieldElement, which an earlier draft of mine did. I'm happy to make that change, though I'll note I don't substantially believe this to be new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. I realize now my comment doesn't iterate over the primary issue. FieldElement does not satisfy the ff API and will not without invasive changes and performance regressions, due to its policy of lazy reduction.
A new type, isolating from the rest of dalek while ensuring proper fulfillment of the intended API, truly seemed optimal.
Alternatively, exposing everything under a hazmat feature and then a wrapper crate may define this ff-compliant type with a pin to an exact version of dalek, including patch, would work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are so many field element types in this codebase I worry about introducing another, especially one with the same name as a different
FieldElement
type (but only when re-exported), it just seems very confusingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heard. While I can point out it's a higher-level on the stack and feature-gated, it'd be better to discuss solutions.
How about it's own file, plus the nomenclature Ff25519 or anything of similar distance? The alternatives would be: