diff --git a/src/arithmetic/fields.rs b/src/arithmetic/fields.rs index bc75289..45b9f7b 100644 --- a/src/arithmetic/fields.rs +++ b/src/arithmetic/fields.rs @@ -64,6 +64,9 @@ pub trait Field: /// The value $t^{-1} \mod 2^S$. const UNROLL_S_EXPONENT: u64; + /// Generator of the $t-order$ multiplicative subgroup + const DELTA: Self; + /// Inverse of $2$ in the field. const TWO_INV: Self; diff --git a/src/arithmetic/fields/fp.rs b/src/arithmetic/fields/fp.rs index f79fb07..a7e0cb9 100644 --- a/src/arithmetic/fields/fp.rs +++ b/src/arithmetic/fields/fp.rs @@ -173,6 +173,20 @@ const ROOT_OF_UNITY: Fp = Fp::from_raw([ 0x2ae45117890ee2fc, ]); +/// GENERATOR^{2^s} where t * 2^s + 1 = p +/// with t odd. In other words, this +/// is a t root of unity. +/// +/// `GENERATOR = 5 mod p` is a generator +/// of the p - 1 order multiplicative +/// subgroup. +const DELTA: Fp = Fp::from_raw([ + 0x1e9372724e80300d, + 0x671383de08b5fe3c, + 0xa99d8b67e918805e, + 0x48796f6fde98a425, +]); + impl Default for Fp { #[inline] fn default() -> Self { @@ -429,6 +443,7 @@ impl Field for Fp { 0x0000000000000000, 0x20000000, ]; + const DELTA: Self = DELTA; const UNROLL_S_EXPONENT: u64 = 0x11cb54e91; const TWO_INV: Self = Fp::from_raw([ 0xd0a0327100000001, diff --git a/src/arithmetic/fields/fq.rs b/src/arithmetic/fields/fq.rs index 24358e3..24fafcc 100644 --- a/src/arithmetic/fields/fq.rs +++ b/src/arithmetic/fields/fq.rs @@ -173,6 +173,20 @@ const ROOT_OF_UNITY: Fq = Fq::from_raw([ 0x113efc510dc03c0b, ]); +/// GENERATOR^{2^s} where t * 2^s + 1 = q +/// with t odd. In other words, this +/// is a t root of unity. +/// +/// `GENERATOR = 5 mod q` is a generator +/// of the q - 1 order multiplicative +/// subgroup. +const DELTA: Fq = Fq::from_raw([ + 0x20daec44973be920, + 0x4243423589e0a9b5, + 0x5127e2ce24a8e69c, + 0x83d2833d15f2bbf9, +]); + impl Default for Fq { #[inline] fn default() -> Self { @@ -444,6 +458,7 @@ impl Field for Fq { 0x0000000000000000, 0x10000000, ]; + const DELTA: Self = DELTA; const UNROLL_S_EXPONENT: u64 = 0x344cfe85d; const TWO_INV: Self = Fq::from_raw([ 0xc21657ea00000001,