Add file to construct fields in Sage#128
Merged
matteo-frigo merged 2 commits intogoogle:mainfrom Apr 8, 2026
Merged
Conversation
Contributor
Author
|
I changed my mind on the name, I want to call this module |
This was referenced Feb 20, 2026
tgeoghegan
reviewed
Feb 25, 2026
Comment on lines
+20
to
+21
| Fp384 = GF(2 ** 384 - 2 ** 128 - 2 ** 96 + 2 ** 32 - 1) | ||
| Fp521 = GF(2 ** 521 - 1) |
Contributor
There was a problem hiding this comment.
I think we discussed elsewhere that P384 and P521 aren't used in any circuits, and so maybe we should omit them from the spec. Same goes for P128, if we re-work test vectors to use P256 and GF(2^128). But then again since these field definitions are so lightweight, we can keep them for now and revisit the discussion of which fields to put in the spec later.
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.
This adds a Python file that handles constructing Sage finite field objects, for use throughout the rest of the reference implementation. This is similar to the code from #32 (comment), but with
^and.<x>desugared, and using Python ints instead ofsage.rings.integer.Integer. This module doesn't provide generators as exported module variables, to avoid confusion between variable names. Generators are instead only created inside function scopes. Other code that needs to access a generator element can call the field'sgens()method later.