Skip to content
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

WIP: Add support for 32-bit limbs in MontConfig #807

Draft
wants to merge 6 commits into
base: support-for-more-backends
Choose a base branch
from
Draft
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
10 changes: 5 additions & 5 deletions curves/bls12_377/src/curves/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ark_ec::{
scalar_mul::glv::GLVConfig,
CurveConfig,
};
use ark_ff::{AdditiveGroup, BigInt, Field, MontFp, PrimeField, Zero};
use ark_ff::{AdditiveGroup, BigInt64, Field, MontFp, PrimeField, Zero};
use ark_std::{ops::Neg, One};

use super::g1_swu_iso::{SwuIsoConfig, ISOGENY_MAP_TO_G1};
Expand Down Expand Up @@ -75,10 +75,10 @@ impl GLVConfig for Config {
MontFp!("8444461749428370424248824938781546531284005582649182570233710176290576793600");

const SCALAR_DECOMP_COEFFS: [(bool, <Self::ScalarField as PrimeField>::BigInt); 4] = [
(true, BigInt!("91893752504881257701523279626832445441")),
(true, BigInt!("1")),
(false, BigInt!("1")),
(true, BigInt!("91893752504881257701523279626832445440")),
(true, BigInt64!("91893752504881257701523279626832445441")),
(true, BigInt64!("1")),
(false, BigInt64!("1")),
(true, BigInt64!("91893752504881257701523279626832445440")),
];

fn endomorphism(p: &SWProjective<Self>) -> SWProjective<Self> {
Expand Down
10 changes: 5 additions & 5 deletions curves/bls12_377/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ark_ec::{
AffineRepr, CurveConfig, CurveGroup, PrimeGroup,
};

use ark_ff::{AdditiveGroup, BigInt, Field, MontFp, PrimeField, Zero};
use ark_ff::{AdditiveGroup, BigInt64, Field, MontFp, PrimeField, Zero};
use ark_std::ops::Neg;

use crate::*;
Expand Down Expand Up @@ -109,10 +109,10 @@ impl GLVConfig for Config {
const LAMBDA: Self::ScalarField = MontFp!("91893752504881257701523279626832445440");

const SCALAR_DECOMP_COEFFS: [(bool, <Self::ScalarField as PrimeField>::BigInt); 4] = [
(false, BigInt!("91893752504881257701523279626832445440")),
(true, BigInt!("1")),
(false, BigInt!("1")),
(false, BigInt!("91893752504881257701523279626832445441")),
(false, BigInt64!("91893752504881257701523279626832445440")),
(true, BigInt64!("1")),
(false, BigInt64!("1")),
(false, BigInt64!("91893752504881257701523279626832445441")),
];

fn endomorphism(p: &Projective<Self>) -> Projective<Self> {
Expand Down
6 changes: 3 additions & 3 deletions curves/bls12_377/src/fields/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_algebra_test_templates::*;
use ark_ff::{
biginteger::{BigInt, BigInteger, BigInteger384},
biginteger::{BigInt64, BigInteger, BigInteger384},
fields::{FftField, Field, Fp6Config, PrimeField},
Fp384, One, UniformRand, Zero,
};
Expand All @@ -20,7 +20,7 @@ test_field!(fq12; Fq12);

#[test]
fn test_fq_repr_from() {
assert_eq!(BigInt::from(100u64), BigInt::new([100, 0, 0, 0, 0, 0]));
assert_eq!(BigInt::from(100u64), BigInt64::new([100, 0, 0, 0, 0, 0]));
}

#[test]
Expand All @@ -39,7 +39,7 @@ fn test_fq_repr_is_odd() {
fn test_fq_repr_is_zero() {
assert!(BigInteger384::from(0u64).is_zero());
assert!(!BigInteger384::from(1u64).is_zero());
assert!(!BigInt::new([0, 0, 0, 0, 1, 0]).is_zero());
assert!(!BigInt64::new([0, 0, 0, 0, 1, 0]).is_zero());
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions curves/bls12_381/src/curves/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ark_ec::{
short_weierstrass::{Affine, SWCurveConfig},
AffineRepr, PrimeGroup,
};
use ark_ff::{AdditiveGroup, BigInt, MontFp, PrimeField, Zero};
use ark_ff::{AdditiveGroup, BigInt64, MontFp, PrimeField, Zero};
use ark_serialize::{Compress, SerializationError};
use ark_std::{ops::Neg, One};

Expand Down Expand Up @@ -158,10 +158,10 @@ impl GLVConfig for Config {
MontFp!("52435875175126190479447740508185965837461563690374988244538805122978187051009");

const SCALAR_DECOMP_COEFFS: [(bool, <Self::ScalarField as PrimeField>::BigInt); 4] = [
(true, BigInt!("228988810152649578064853576960394133504")),
(true, BigInt!("1")),
(false, BigInt!("1")),
(true, BigInt!("228988810152649578064853576960394133503")),
(true, BigInt64!("228988810152649578064853576960394133504")),
(true, BigInt64!("1")),
(false, BigInt64!("1")),
(true, BigInt64!("228988810152649578064853576960394133503")),
];

fn endomorphism(p: &G1Projective) -> G1Projective {
Expand Down
10 changes: 5 additions & 5 deletions curves/bls12_381/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use ark_ec::{
short_weierstrass::{Affine, Projective, SWCurveConfig},
AffineRepr, CurveGroup, PrimeGroup,
};
use ark_ff::{AdditiveGroup, BigInt, Field, MontFp, PrimeField, Zero};
use ark_ff::{AdditiveGroup, BigInt64, Field, MontFp, PrimeField, Zero};
use ark_serialize::{Compress, SerializationError};

use super::{
Expand Down Expand Up @@ -197,10 +197,10 @@ impl GLVConfig for Config {
const LAMBDA: Self::ScalarField = MontFp!("228988810152649578064853576960394133503");

const SCALAR_DECOMP_COEFFS: [(bool, <Self::ScalarField as PrimeField>::BigInt); 4] = [
(false, BigInt!("228988810152649578064853576960394133503")),
(true, BigInt!("1")),
(false, BigInt!("1")),
(false, BigInt!("228988810152649578064853576960394133504")),
(false, BigInt64!("228988810152649578064853576960394133503")),
(true, BigInt64!("1")),
(false, BigInt64!("1")),
(false, BigInt64!("228988810152649578064853576960394133504")),
];

fn endomorphism(p: &Projective<Self>) -> Projective<Self> {
Expand Down
Loading
Loading