From 6fd30289569f72df0ba2d27ae3b7048cdbf354d7 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Tue, 31 Jan 2017 17:19:34 -0500 Subject: [PATCH] Add constant for 4*d --- src/constants.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/constants.rs b/src/constants.rs index 09f1772..1607258 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -29,6 +29,9 @@ pub const d: FieldElement = FieldElement([ pub const d2: FieldElement = FieldElement([ -21827239, -5839606, -30745221, 13898782, 229458, 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) pub const SQRT_M1: FieldElement = FieldElement([ @@ -1520,6 +1523,13 @@ mod test { 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 /// of the basepoint. #[test]