mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-06 20:20:34 +00:00
commit
1e73f97a24
3 changed files with 16 additions and 18 deletions
10
Cargo.toml
10
Cargo.toml
|
|
@ -36,14 +36,12 @@ harness = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
backtrace = { version = "0.3", optional = true }
|
backtrace = { version = "0.3", optional = true }
|
||||||
bitvec = "0.18"
|
|
||||||
subtle = "2.3"
|
subtle = "2.3"
|
||||||
crossbeam-utils = "0.7"
|
crossbeam-utils = "0.8"
|
||||||
ff = "0.8"
|
ff = "0.9"
|
||||||
metrics = "=0.13.0-alpha.13"
|
metrics = "0.14.2"
|
||||||
metrics-macros = "=0.1.0-alpha.9"
|
|
||||||
num_cpus = "1.13"
|
num_cpus = "1.13"
|
||||||
rand = "0.7"
|
rand = "0.8"
|
||||||
blake2b_simd = "0.5"
|
blake2b_simd = "0.5"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
static_assertions = "1.1.0"
|
static_assertions = "1.1.0"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use bitvec::{array::BitArray, order::Lsb0};
|
|
||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::ops::{Add, Mul, Neg, Sub};
|
use core::ops::{Add, Mul, Neg, Sub};
|
||||||
|
use ff::FieldBits;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
|
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
|
||||||
|
|
@ -550,7 +550,7 @@ impl ff::PrimeField for Fp {
|
||||||
self.to_bytes()
|
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();
|
let bytes = self.to_bytes();
|
||||||
|
|
||||||
#[cfg(not(target_pointer_width = "64"))]
|
#[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()),
|
u64::from_le_bytes(bytes[24..32].try_into().unwrap()),
|
||||||
];
|
];
|
||||||
|
|
||||||
BitArray::new(limbs)
|
FieldBits::new(limbs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_odd(&self) -> bool {
|
fn is_odd(&self) -> bool {
|
||||||
self.to_bytes()[0] & 1 == 1
|
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"))]
|
#[cfg(not(target_pointer_width = "64"))]
|
||||||
{
|
{
|
||||||
BitArray::new(MODULUS_LIMBS_32)
|
FieldBits::new(MODULUS_LIMBS_32)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_pointer_width = "64")]
|
#[cfg(target_pointer_width = "64")]
|
||||||
BitArray::new(MODULUS.0)
|
FieldBits::new(MODULUS.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn multiplicative_generator() -> Self {
|
fn multiplicative_generator() -> Self {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use bitvec::{array::BitArray, order::Lsb0};
|
|
||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::ops::{Add, Mul, Neg, Sub};
|
use core::ops::{Add, Mul, Neg, Sub};
|
||||||
|
use ff::FieldBits;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
|
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
|
||||||
|
|
@ -550,7 +550,7 @@ impl ff::PrimeField for Fq {
|
||||||
self.to_bytes()
|
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();
|
let bytes = self.to_bytes();
|
||||||
|
|
||||||
#[cfg(not(target_pointer_width = "64"))]
|
#[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()),
|
u64::from_le_bytes(bytes[24..32].try_into().unwrap()),
|
||||||
];
|
];
|
||||||
|
|
||||||
BitArray::new(limbs)
|
FieldBits::new(limbs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_odd(&self) -> bool {
|
fn is_odd(&self) -> bool {
|
||||||
self.to_bytes()[0] & 1 == 1
|
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"))]
|
#[cfg(not(target_pointer_width = "64"))]
|
||||||
{
|
{
|
||||||
BitArray::new(MODULUS_LIMBS_32)
|
FieldBits::new(MODULUS_LIMBS_32)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_pointer_width = "64")]
|
#[cfg(target_pointer_width = "64")]
|
||||||
BitArray::new(MODULUS.0)
|
FieldBits::new(MODULUS.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn multiplicative_generator() -> Self {
|
fn multiplicative_generator() -> Self {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue