diff --git a/src/bls12_381/fq.rs b/src/bls12_381/fq.rs index e7be0ec59..a59d06851 100644 --- a/src/bls12_381/fq.rs +++ b/src/bls12_381/fq.rs @@ -25,7 +25,7 @@ const INV: u64 = 0x89f3fffcfffcfffd; const GENERATOR: FqRepr = FqRepr([0x321300000006554f, 0xb93c0018d6c40005, 0x57605e0db0ddbb51, 0x8b256521ed1f9bcb, 0x6cf28d7901622c03, 0x11ebab9dbb81e28c]); // 2^s * t = MODULUS - 1 with t odd -const S: usize = 1; +const S: u32 = 1; // 2^s root of unity computed by GENERATOR^t const ROOT_OF_UNITY: FqRepr = FqRepr([0x43f5fffffffcaaae, 0x32b7fff2ed47fffd, 0x7e83a49a2e99d69, 0xeca8f3318332bb7a, 0xef148d1ea0f4c069, 0x40ab3263eff0206]); @@ -444,7 +444,7 @@ impl PrimeField for Fq { Fq(GENERATOR) } - fn s() -> usize { + fn s() -> u32 { S } diff --git a/src/bls12_381/fr.rs b/src/bls12_381/fr.rs index 63cc26476..d62f2659b 100644 --- a/src/bls12_381/fr.rs +++ b/src/bls12_381/fr.rs @@ -23,7 +23,7 @@ const INV: u64 = 0xfffffffeffffffff; const GENERATOR: FrRepr = FrRepr([0xefffffff1, 0x17e363d300189c0f, 0xff9c57876f8457b0, 0x351332208fc5a8c4]); // 2^s * t = MODULUS - 1 with t odd -const S: usize = 32; +const S: u32 = 32; // 2^s root of unity computed by GENERATOR^t const ROOT_OF_UNITY: FrRepr = FrRepr([0xb9b58d8c5f0e466a, 0x5b1b4c801819d7ec, 0xaf53ae352a31e64, 0x5bf3adda19e9b27b]); @@ -264,7 +264,7 @@ impl PrimeField for Fr { Fr(GENERATOR) } - fn s() -> usize { + fn s() -> u32 { S } diff --git a/src/lib.rs b/src/lib.rs index 6e98aa6ec..12b4af6d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -496,7 +496,7 @@ pub trait PrimeField: Field fn multiplicative_generator() -> Self; /// Returns s such that 2^s * t = `char()` - 1 with t odd. - fn s() -> usize; + fn s() -> u32; /// Returns the 2^s root of unity computed by exponentiating the `multiplicative_generator()` /// by t.