This commit is contained in:
Jack Grigg 2021-02-17 20:42:27 +00:00
parent 2c77eccf01
commit 0c4f779993
3 changed files with 14 additions and 15 deletions

View file

@ -36,13 +36,12 @@ harness = false
[dependencies]
backtrace = { version = "0.3", optional = true }
bitvec = "0.18"
subtle = "2.3"
crossbeam-utils = "0.7"
ff = "0.8"
ff = "0.9"
metrics = "0.14.2"
num_cpus = "1.13"
rand = "0.7"
rand = "0.8"
blake2b_simd = "0.5"
lazy_static = "1.4.0"
static_assertions = "1.1.0"

View file

@ -1,7 +1,7 @@
use bitvec::{array::BitArray, order::Lsb0};
use core::convert::TryInto;
use core::fmt;
use core::ops::{Add, Mul, Neg, Sub};
use ff::FieldBits;
use lazy_static::lazy_static;
use rand::RngCore;
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
@ -550,7 +550,7 @@ impl ff::PrimeField for Fp {
self.to_bytes()
}
fn to_le_bits(&self) -> BitArray<Lsb0, Self::ReprBits> {
fn to_le_bits(&self) -> FieldBits<Self::ReprBits> {
let bytes = self.to_bytes();
#[cfg(not(target_pointer_width = "64"))]
@ -573,21 +573,21 @@ impl ff::PrimeField for Fp {
u64::from_le_bytes(bytes[24..32].try_into().unwrap()),
];
BitArray::new(limbs)
FieldBits::new(limbs)
}
fn is_odd(&self) -> bool {
self.to_bytes()[0] & 1 == 1
}
fn char_le_bits() -> BitArray<Lsb0, Self::ReprBits> {
fn char_le_bits() -> FieldBits<Self::ReprBits> {
#[cfg(not(target_pointer_width = "64"))]
{
BitArray::new(MODULUS_LIMBS_32)
FieldBits::new(MODULUS_LIMBS_32)
}
#[cfg(target_pointer_width = "64")]
BitArray::new(MODULUS.0)
FieldBits::new(MODULUS.0)
}
fn multiplicative_generator() -> Self {

View file

@ -1,7 +1,7 @@
use bitvec::{array::BitArray, order::Lsb0};
use core::convert::TryInto;
use core::fmt;
use core::ops::{Add, Mul, Neg, Sub};
use ff::FieldBits;
use lazy_static::lazy_static;
use rand::RngCore;
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
@ -550,7 +550,7 @@ impl ff::PrimeField for Fq {
self.to_bytes()
}
fn to_le_bits(&self) -> BitArray<Lsb0, Self::ReprBits> {
fn to_le_bits(&self) -> FieldBits<Self::ReprBits> {
let bytes = self.to_bytes();
#[cfg(not(target_pointer_width = "64"))]
@ -573,21 +573,21 @@ impl ff::PrimeField for Fq {
u64::from_le_bytes(bytes[24..32].try_into().unwrap()),
];
BitArray::new(limbs)
FieldBits::new(limbs)
}
fn is_odd(&self) -> bool {
self.to_bytes()[0] & 1 == 1
}
fn char_le_bits() -> BitArray<Lsb0, Self::ReprBits> {
fn char_le_bits() -> FieldBits<Self::ReprBits> {
#[cfg(not(target_pointer_width = "64"))]
{
BitArray::new(MODULUS_LIMBS_32)
FieldBits::new(MODULUS_LIMBS_32)
}
#[cfg(target_pointer_width = "64")]
BitArray::new(MODULUS.0)
FieldBits::new(MODULUS.0)
}
fn multiplicative_generator() -> Self {