-
Notifications
You must be signed in to change notification settings - Fork 266
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
The implementation of towered fields is difficult to relate to documented constructions #264
Comments
I agree that the irreducible polynomial is basically hidden throughout both repos. And it seems that the current implementations in https://github.com/arkworks-rs/algebra/tree/master/ff/src/fields/models focus on only specific irreducible polynomials. Should we add more explanations in |
(Note: generally there exist some prime numbers that could cause some of these polynomials to be not irreducible, but it seems to be rare) |
If I had to guess by extrapolation from BLS12-381, I'd guess that a k-extension uses the irreducible polynomial uk - More explanation would definitely be good! It's not so rare; e.g. Pluto's field cannot use u2 + 1 for Fp2, and so it is currently specified to use u2 + 5 (I'll change that if needed). In fact u2 + 1 will never be irreducible for a pairing or half-pairing cycle with high 2-adicity, because we must have p = 1 (mod 8). |
This is blocking my implementation of Pluto and Triton in arkworks-rs/curves#54. The documentation needed is of how the constants such as |
The documentation on |
So it seems that it is possible to implement u^2+5, just one needs to choose the NONRESIDUE in Fq2Parameters to be -5. On a related note, I recently also implemented the BN446 inside the arkworks environment here: https://github.com/oblivious-file-sharing/netherite-algebra/tree/main/src/curve_bn446 |
(This issue spans
algebra
andcurves
, but seems more pertinent here.)Consider the implementation of towers of field extensions, for example here for BLS12-381. The usual way to describe such towers is by the irreducible polynomial used for each extension. For instance, the bls12_381 crate implements Fp2 as Fp[u]/(u2 + 1), and then Fp6 as Fp2[v]/(v3 - (u + 1)), and then Fp12 as Fp6[w]/(w2 - v).
(Strictly speaking there's an abuse of notation here because, e.g. when we write Fp6[w]/(w2 - v) we're conflating the field Fp6 with its representation, but apparently everyone abuses notation that way.)
The choice of irreducible polynomials is fairly arbitrary, but for interoperability it's best for the originator of a curve to pick them and for everyone to use the same ones for that curve. A specific representation for each extension field used by a pairing is needed, at least in order to unambiguously specify the curve and generator for G2, and for test vectors. (You can technically convert between representations, but it's a pain and no-one should need to do that extra work.)
The problem is that the implementation of a tower in arkworks doesn't directly specify these irreducible polynomials (and also doesn't document what they are for existing implementations). Each extension specifies a
NONRESIDUE
, and Fp2 extensions also specify aQUADRATIC_NONRESIDUE
, but I can't tell how these relate to the irreducible polynomial, even after poring over the implementations inalgebra/ff/src/fields/models
.The text was updated successfully, but these errors were encountered: