From 11c5ddbc0298d131a594b1599a58a1d5ad46c22d Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 20 Sep 2021 21:35:41 +0100 Subject: [PATCH] Remove `FieldExt::{RESCUE_ALPHA, RESCUE_INVALPHA}` --- CHANGELOG.md | 1 + src/arithmetic/fields.rs | 7 ------- src/fields/fp.rs | 19 ------------------- src/fields/fq.rs | 19 ------------------- 4 files changed, 1 insertion(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f36eca8..e9fc650 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to Rust's notion of - `FieldExt::ROOT_OF_UNITY` (use `ff::PrimeField::root_of_unity` instead). - `FieldExt::{T_MINUS1_OVER2, pow_by_t_minus1_over2, sqrt_alt, sqrt_ratio}` (moved to `SqrtRatio` trait). + - `FieldExt::{RESCUE_ALPHA, RESCUE_INVALPHA}` ## [0.2.1] - 2021-09-17 ### Changed diff --git a/src/arithmetic/fields.rs b/src/arithmetic/fields.rs index e2488fa..79803b2 100644 --- a/src/arithmetic/fields.rs +++ b/src/arithmetic/fields.rs @@ -74,13 +74,6 @@ pub trait FieldExt: SqrtRatio + From + Ord + Group { /// Inverse of $2$ in the field. const TWO_INV: Self; - /// Ideally the smallest prime $\alpha$ such that gcd($p - 1$, $\alpha$) = $1$ - const RESCUE_ALPHA: u64; - - /// $RESCUE_INVALPHA \cdot RESCUE_ALPHA = 1 \mod p - 1$ such that - /// `(a^RESCUE_ALPHA)^RESCUE_INVALPHA = a`. - const RESCUE_INVALPHA: [u64; 4]; - /// Element of multiplicative order $3$. const ZETA: Self; diff --git a/src/fields/fp.rs b/src/fields/fp.rs index 8c1baf3..8e67510 100644 --- a/src/fields/fp.rs +++ b/src/fields/fp.rs @@ -730,13 +730,6 @@ impl FieldExt for Fp { 0x0000000000000000, 0x2000000000000000, ]); - const RESCUE_ALPHA: u64 = 5; - const RESCUE_INVALPHA: [u64; 4] = [ - 0xe0f0f3f0cccccccd, - 0x4e9ee0c9a10a60e2, - 0x3333333333333333, - 0x3333333333333333, - ]; const ZETA: Self = Fp::from_raw([ 0x1dad5ebdfdfe4ab9, 0x1d1f8bd237ad3149, @@ -807,18 +800,6 @@ fn test_inv() { assert_eq!(inv, INV); } -#[cfg(feature = "std")] -#[test] -fn test_rescue() { - // NB: TWO_INV is standing in as a "random" field element - assert_eq!( - Fp::TWO_INV - .pow_vartime(&[Fp::RESCUE_ALPHA, 0, 0, 0]) - .pow_vartime(&Fp::RESCUE_INVALPHA), - Fp::TWO_INV - ); -} - #[cfg(feature = "std")] #[test] fn test_sqrt() { diff --git a/src/fields/fq.rs b/src/fields/fq.rs index 7ea2498..548c488 100644 --- a/src/fields/fq.rs +++ b/src/fields/fq.rs @@ -730,13 +730,6 @@ impl FieldExt for Fq { 0x0000000000000000, 0x2000000000000000, ]); - const RESCUE_ALPHA: u64 = 5; - const RESCUE_INVALPHA: [u64; 4] = [ - 0xd69f2280cccccccd, - 0x4e9ee0c9a143ba4a, - 0x3333333333333333, - 0x3333333333333333, - ]; const ZETA: Self = Fq::from_raw([ 0x2aa9d2e050aa0e4f, 0x0fed467d47c033af, @@ -807,18 +800,6 @@ fn test_inv() { assert_eq!(inv, INV); } -#[cfg(feature = "std")] -#[test] -fn test_rescue() { - // NB: TWO_INV is standing in as a "random" field element - assert_eq!( - Fq::TWO_INV - .pow_vartime(&[Fq::RESCUE_ALPHA, 0, 0, 0]) - .pow_vartime(&Fq::RESCUE_INVALPHA), - Fq::TWO_INV - ); -} - #[cfg(feature = "std")] #[test] fn test_sqrt() {