Change ZETA constant of Fp to make it consistent with the endomorphism over Fq.

This commit is contained in:
Sean Bowe 2020-12-07 09:42:33 -07:00
parent e7c4213537
commit 81345e0cf1
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
2 changed files with 15 additions and 5 deletions

View File

@ -11,3 +11,13 @@ pub mod vesta;
pub use curves::*; pub use curves::*;
pub use fields::*; pub use fields::*;
#[test]
fn test_endo_consistency() {
use crate::arithmetic::{Curve, FieldExt};
let a = pallas::Point::one();
assert_eq!(a * pallas::Scalar::ZETA, a.endo());
let a = vesta::Point::one();
assert_eq!(a * vesta::Scalar::ZETA, a.endo());
}

View File

@ -671,10 +671,10 @@ impl FieldExt for Fp {
0x3333333333333333, 0x3333333333333333,
]; ];
const ZETA: Self = Fp::from_raw([ const ZETA: Self = Fp::from_raw([
0x7b7fd22f0201b547, 0x1dad5ebdfdfe4ab9,
0x05270d29d19fc7d2, 0x1d1f8bd237ad3149,
0xd3552a23a8554e50, 0x2caad5dc57aab1b0,
0x2d33357cb532458e, 0x12ccca834acdba71,
]); ]);
fn ct_is_zero(&self) -> Choice { fn ct_is_zero(&self) -> Choice {
@ -802,7 +802,7 @@ fn test_deterministic_sqrt() {
fn test_zeta() { fn test_zeta() {
assert_eq!( assert_eq!(
format!("{:?}", Fp::ZETA), format!("{:?}", Fp::ZETA),
"0x2d33357cb532458ed3552a23a8554e5005270d29d19fc7d27b7fd22f0201b547" "0x12ccca834acdba712caad5dc57aab1b01d1f8bd237ad31491dad5ebdfdfe4ab9"
); );
let a = Fp::ZETA; let a = Fp::ZETA;