diff --git a/src/constants.rs b/src/constants.rs index a624c6a..4c5176d 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -19,6 +19,7 @@ use field::FieldElement; use curve::PreComputedPoint; +use curve::CompressedPoint; pub const d: FieldElement = FieldElement([ -10913610, 13857413, -15372611, 6949391, 114729, @@ -54,6 +55,16 @@ pub const HALF_Q_MINUS_1_BYTES: [u8; 32] = [ // halfQMinus1Bytes 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, ]; +/// Basepoint has y = 4/5. +/// +/// Generated with Sage: these are the bytes of 4/5 in 𝔽_p. The +/// sign bit is 0 since the basepoint has x chosen to be positive. +pub const BASE_CMPRSSD: CompressedPoint = + CompressedPoint([0x58, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66]); + pub const bi: [PreComputedPoint; 8] = [ PreComputedPoint{ y_plus_x: FieldElement([25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605]), diff --git a/src/curve.rs b/src/curve.rs index 1ce690d..8af03a5 100644 --- a/src/curve.rs +++ b/src/curve.rs @@ -821,19 +821,10 @@ mod test { use field::FieldElement; use scalar::Scalar; use constants; + use constants::BASE_CMPRSSD; use super::*; use super::select_precomputed_point; - /// Basepoint has y = 4/5. - /// - /// Generated with Sage: these are the bytes of 4/5 in 𝔽_p. The - /// sign bit is 0 since the basepoint has x chosen to be positive. - static BASE_CMPRSSD: CompressedPoint = - CompressedPoint([0x58, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66]); - /// X coordinate of the basepoint. /// = 15112221349535400772501151409588531511454012693041857206046113283949847762202 static BASE_X_COORD_BYTES: [u8; 32] =