mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-03 09:29:46 +00:00
Sane char_le_bits
This commit is contained in:
parent
24bdd7ed9b
commit
6f8a5d0ede
1 changed files with 2 additions and 5 deletions
|
@ -22,7 +22,7 @@ use subtle::{Choice, CtOption};
|
||||||
pub use curve25519_dalek as dalek;
|
pub use curve25519_dalek as dalek;
|
||||||
|
|
||||||
use dalek::{
|
use dalek::{
|
||||||
constants,
|
constants::{self, BASEPOINT_ORDER},
|
||||||
scalar::Scalar as DScalar,
|
scalar::Scalar as DScalar,
|
||||||
edwards::{EdwardsPoint as DEdwardsPoint, EdwardsBasepointTable, CompressedEdwardsY},
|
edwards::{EdwardsPoint as DEdwardsPoint, EdwardsBasepointTable, CompressedEdwardsY},
|
||||||
ristretto::{RistrettoPoint as DRistrettoPoint, RistrettoBasepointTable, CompressedRistretto},
|
ristretto::{RistrettoPoint as DRistrettoPoint, RistrettoBasepointTable, CompressedRistretto},
|
||||||
|
@ -300,10 +300,7 @@ impl PrimeFieldBits for Scalar {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn char_le_bits() -> FieldBits<Self::ReprBits> {
|
fn char_le_bits() -> FieldBits<Self::ReprBits> {
|
||||||
let mut bytes = (Scalar::ZERO - Scalar::ONE).to_repr();
|
BASEPOINT_ORDER.to_bytes().into()
|
||||||
bytes[0] += 1;
|
|
||||||
debug_assert_eq!(DScalar::from_bytes_mod_order(bytes), DScalar::ZERO);
|
|
||||||
bytes.into()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue