lambdaworks
lambdaworks copied to clipboard
Add Babybear field to pre defined fields
This task consists of three tasks:
- [x] Add Babybear field to pre defined fields on : math/src/field/fields/fft_friendly, using the right modulus.
- [x] Implement IsPrimeField for BabyBear
- [x] Make it FFT friendly
- [ ] Add the degree six and eight extension
For reference, this is the 31 bit used by Risc Zero, as described here:
This field is suitable to be used with the MontgomeryBackend. It can be done with a small MontgomeryBackend of 32 bits later. But if it's not available when doing this issue, it can be done using the one with u64 limbs.
Constant for the modulus is:
2^31 - 2^27 + 1
For first time contributors, we recommend doing task 1, then 2, then 3, and skip task 4.
It may be useful to finish this issue before three, but it's not mandatory.
Do you want the babybear field to be in a similar vein as https://github.com/lambdaclass/lambdaworks/blob/main/math/src/field/fields/p448_goldilocks_prime_field.rs?
Since there's code for the FFT/NTT, there should be a test to check if it's working properly. It can be submitted as a package of IsFFt with tests in another PR, or fixed here. The IsFieldpart seems right.
@MauroToscano which tests? which code are you referring to?