Skip to content

Add support for 448-bit integers and fields #261

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

Merged
merged 2 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ff/src/biginteger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ bigint_impl!(BigInteger128, 2);
bigint_impl!(BigInteger256, 4);
bigint_impl!(BigInteger320, 5);
bigint_impl!(BigInteger384, 6);
bigint_impl!(BigInteger448, 7);
bigint_impl!(BigInteger768, 12);
bigint_impl!(BigInteger832, 13);

Expand Down
6 changes: 6 additions & 0 deletions ff/src/biginteger/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ fn test_biginteger384() {
test_biginteger(B::new([0u64; 6]));
}

#[test]
fn test_biginteger448() {
use crate::biginteger::BigInteger448 as B;
test_biginteger(B::new([0u64; 7]));
}

#[test]
fn test_biginteger768() {
use crate::biginteger::BigInteger768 as B;
Expand Down
4 changes: 3 additions & 1 deletion ff/src/fields/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,15 @@ impl<Slice: AsRef<[u64]>> Iterator for BitIteratorLE<Slice> {
}

use crate::biginteger::{
BigInteger256, BigInteger320, BigInteger384, BigInteger64, BigInteger768, BigInteger832,
BigInteger256, BigInteger320, BigInteger384, BigInteger448, BigInteger64, BigInteger768,
BigInteger832,
};

impl_field_bigint_conv!(Fp64, BigInteger64, Fp64Parameters);
impl_field_bigint_conv!(Fp256, BigInteger256, Fp256Parameters);
impl_field_bigint_conv!(Fp320, BigInteger320, Fp320Parameters);
impl_field_bigint_conv!(Fp384, BigInteger384, Fp384Parameters);
impl_field_bigint_conv!(Fp448, BigInteger448, Fp448Parameters);
impl_field_bigint_conv!(Fp768, BigInteger768, Fp768Parameters);
impl_field_bigint_conv!(Fp832, BigInteger832, Fp832Parameters);

Expand Down
3 changes: 2 additions & 1 deletion ff/src/fields/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use num_traits::{One, Zero};
use crate::{
biginteger::{
arithmetic as fa, BigInteger as _BigInteger, BigInteger256, BigInteger320, BigInteger384,
BigInteger64, BigInteger768, BigInteger832,
BigInteger448, BigInteger64, BigInteger768, BigInteger832,
},
bytes::{FromBytes, ToBytes},
fields::{FftField, Field, FpParameters, LegendreSymbol, PrimeField, SquareRootField},
Expand All @@ -22,6 +22,7 @@ impl_Fp!(Fp64, Fp64Parameters, BigInteger64, BigInteger64, 1);
impl_Fp!(Fp256, Fp256Parameters, BigInteger256, BigInteger256, 4);
impl_Fp!(Fp320, Fp320Parameters, BigInteger320, BigInteger320, 5);
impl_Fp!(Fp384, Fp384Parameters, BigInteger384, BigInteger384, 6);
impl_Fp!(Fp448, Fp448Parameters, BigInteger448, BigInteger448, 7);
impl_Fp!(Fp768, Fp768Parameters, BigInteger768, BigInteger768, 12);
impl_Fp!(Fp832, Fp832Parameters, BigInteger832, BigInteger832, 13);

Expand Down