Add DELTA generator of t-order multiplicative subgroup to Fp, Fq

This commit is contained in:
therealyingtong 2020-08-29 13:51:42 +08:00
parent 4c9a05ba74
commit 4f8570db95
No known key found for this signature in database
GPG key ID: 179F32A1503D607E
3 changed files with 33 additions and 0 deletions

View file

@ -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;

View file

@ -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,

View file

@ -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,