pub struct Fp480 { /* private fields */ }Implementations§
Source§impl Fp480
impl Fp480
pub fn to_monty(self) -> Monty
Sourcepub fn normalize_assign_little(&mut self)
pub fn normalize_assign_little(&mut self)
See normalize_little_limbs.
Sourcepub fn normalize_little_limbs(limbs: [u32; 16]) -> [u32; 16]
pub fn normalize_little_limbs(limbs: [u32; 16]) -> [u32; 16]
This normalize should only be used when the input is at most 2*p-1.
Sourcepub fn normalize_little(self) -> Self
pub fn normalize_little(self) -> Self
See normalize_little_limbs.
Sourcepub fn to_bytes_array(&self) -> [u8; 60]
pub fn to_bytes_array(&self) -> [u8; 60]
Convert the value to a byte array which is PRIMEBYTES long.
Ported from BearSSL br_i31_encode.
Sourcepub fn new(digits: [u32; 16]) -> Fp480
pub fn new(digits: [u32; 16]) -> Fp480
Create a new instance given the raw limbs form. Note that this is least significant bit first.
pub fn to_str_hex(&self) -> String
pub fn iter_bit(&self) -> FpBitIter<'_, Fp480> ⓘ
Trait Implementations§
Source§impl AddAssign for Fp480
impl AddAssign for Fp480
Source§fn add_assign(&mut self, other: Fp480)
fn add_assign(&mut self, other: Fp480)
+= operation. Read moreSource§impl ConstantSwap for Fp480
impl ConstantSwap for Fp480
Source§impl LowerHex for Fp480
Prints the hex value of the number in big endian (most significant
digit on the left and least on the right) to make debugging easier.
impl LowerHex for Fp480
Prints the hex value of the number in big endian (most significant digit on the left and least on the right) to make debugging easier.
Source§impl Mul<u32> for Fp480
Note that this reveals the u32, but nothing else. It’s expected that the u32 is not secret.
If it is, you can use Mul<$classname>
impl Mul<u32> for Fp480
Note that this reveals the u32, but nothing else. It’s expected that the u32 is not secret. If it is, you can use Mul<$classname>
Source§impl MulAssign for Fp480
Note that this uses a conversion to montgomery form and then multiplies by the other value to get back out.
This takes less time than just doing the multiplication and doing a reduction.
impl MulAssign for Fp480
Note that this uses a conversion to montgomery form and then multiplies by the other value to get back out. This takes less time than just doing the multiplication and doing a reduction.
Source§fn mul_assign(&mut self, rhs: Fp480)
fn mul_assign(&mut self, rhs: Fp480)
*= operation. Read moreSource§impl Ord for Fp480
impl Ord for Fp480
Source§impl PartialOrd for Fp480
impl PartialOrd for Fp480
Source§impl Pow<Fp480> for Fp480
impl Pow<Fp480> for Fp480
Source§fn pow(self, rhs: Fp480) -> Fp480
fn pow(self, rhs: Fp480) -> Fp480
14.94 Algorithm Montgomery exponentiation in Handbook of Applied Crypto INPUT:m=(ml−1···m0)b,R=bl,m′ =−m−1 modb,e=(et···e0)2 withet =1, and an integer x, 1 ≤ x < m. OUTPUT: xe mod m.
- x← Mont(x,R2 mod m), A←R mod m. (R mod m and R2 mod m may be pro-ided as inputs.)
- For i from t down to 0 do the following: 2.1 A←Mont(A,A). 2.2 If ei = 1 then A← Mont(A, x).
- A←Mont(A,1).
- Return(A).
Source§impl SubAssign for Fp480
impl SubAssign for Fp480
Source§fn sub_assign(&mut self, other: Fp480)
fn sub_assign(&mut self, other: Fp480)
-= operation. Read more