mirror of
https://github.com/arnaucube/Nova.git
synced 2026-01-11 16:41:28 +01:00
move from rug to num-bigint (#53)
This commit is contained in:
@@ -10,7 +10,7 @@ use bellperson::{
|
||||
};
|
||||
use bellperson_nonnative::mp::bignat::{nat_to_limbs, BigNat};
|
||||
use ff::{Field, PrimeField, PrimeFieldBits};
|
||||
use rug::Integer;
|
||||
use num_bigint::BigInt;
|
||||
|
||||
/// Gets as input the little indian representation of a number and spits out the number
|
||||
#[allow(dead_code)]
|
||||
@@ -116,7 +116,7 @@ pub fn scalar_as_base<G: Group>(input: G::Scalar) -> G::Base {
|
||||
/// Allocate bignat a constant
|
||||
pub fn alloc_bignat_constant<F: PrimeField, CS: ConstraintSystem<F>>(
|
||||
mut cs: CS,
|
||||
val: &Integer,
|
||||
val: &BigInt,
|
||||
limb_width: usize,
|
||||
n_limbs: usize,
|
||||
) -> Result<BigNat<F>, SynthesisError> {
|
||||
|
||||
11
src/pasta.rs
11
src/pasta.rs
@@ -6,6 +6,8 @@ use crate::{
|
||||
use core::ops::Mul;
|
||||
use ff::Field;
|
||||
use merlin::Transcript;
|
||||
use num_bigint::BigInt;
|
||||
use num_traits::Num;
|
||||
use pasta_curves::{
|
||||
self,
|
||||
arithmetic::{CurveAffine, CurveExt, Group as Grp},
|
||||
@@ -14,7 +16,6 @@ use pasta_curves::{
|
||||
};
|
||||
use rand::SeedableRng;
|
||||
use rand_chacha::ChaCha20Rng;
|
||||
use rug::Integer;
|
||||
|
||||
//////////////////////////////////////Pallas///////////////////////////////////////////////
|
||||
|
||||
@@ -75,8 +76,8 @@ impl Group for pallas::Point {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_order() -> Integer {
|
||||
Integer::from_str_radix(
|
||||
fn get_order() -> BigInt {
|
||||
BigInt::from_str_radix(
|
||||
"40000000000000000000000000000000224698fc0994a8dd8c46eb2100000001",
|
||||
16,
|
||||
)
|
||||
@@ -163,8 +164,8 @@ impl Group for vesta::Point {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_order() -> Integer {
|
||||
Integer::from_str_radix(
|
||||
fn get_order() -> BigInt {
|
||||
BigInt::from_str_radix(
|
||||
"40000000000000000000000000000000224698fc094cf91b992d30ed00000001",
|
||||
16,
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ use core::{
|
||||
};
|
||||
use ff::{PrimeField, PrimeFieldBits};
|
||||
use merlin::Transcript;
|
||||
use rug::Integer;
|
||||
use num_bigint::BigInt;
|
||||
|
||||
/// Represents an element of a group
|
||||
pub trait Group:
|
||||
@@ -53,7 +53,7 @@ pub trait Group:
|
||||
fn to_coordinates(&self) -> (Self::Base, Self::Base, bool);
|
||||
|
||||
/// Returns the order of the group as a big integer
|
||||
fn get_order() -> Integer;
|
||||
fn get_order() -> BigInt;
|
||||
}
|
||||
|
||||
/// Represents a compressed version of a group element
|
||||
|
||||
Reference in New Issue
Block a user