mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-06 20:41:14 +00:00
Add constant for 4*d
This commit is contained in:
parent
fb0c431184
commit
6fd3028956
1 changed files with 10 additions and 0 deletions
|
|
@ -29,6 +29,9 @@ pub const d: FieldElement = FieldElement([
|
||||||
pub const d2: FieldElement = FieldElement([
|
pub const d2: FieldElement = FieldElement([
|
||||||
-21827239, -5839606, -30745221, 13898782, 229458,
|
-21827239, -5839606, -30745221, 13898782, 229458,
|
||||||
15978800, -12551817, -6495438, 29715968, 9444199, ]);
|
15978800, -12551817, -6495438, 29715968, 9444199, ]);
|
||||||
|
pub const d4: FieldElement = FieldElement([
|
||||||
|
23454405, -11679213, 5618422, -5756869, 458917,
|
||||||
|
-1596832, -25103633, -12990876, -7676928, -14666033 ]);
|
||||||
|
|
||||||
/// Precomputed value of one of the square roots of -1 (mod p)
|
/// Precomputed value of one of the square roots of -1 (mod p)
|
||||||
pub const SQRT_M1: FieldElement = FieldElement([
|
pub const SQRT_M1: FieldElement = FieldElement([
|
||||||
|
|
@ -1520,6 +1523,13 @@ mod test {
|
||||||
assert_eq!(d2, constants::d2);
|
assert_eq!(d2, constants::d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_d4() {
|
||||||
|
let mut four = FieldElement::zero();
|
||||||
|
four[0] = 4;
|
||||||
|
assert_eq!(&constants::d * &four, constants::d4);
|
||||||
|
}
|
||||||
|
|
||||||
/// Test the values in the lookup table of precomputed multiples
|
/// Test the values in the lookup table of precomputed multiples
|
||||||
/// of the basepoint.
|
/// of the basepoint.
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue