pub struct FieldElement(/* private fields */);
Expand description
P-521 field element representing values in Fₚ (p = 2^521 − 1). Internally stored as 17 little-endian 32-bit limbs; only the low 9 bits of limb 16 are significant.
Implementations§
Source§impl FieldElement
impl FieldElement
Source§impl FieldElement
impl FieldElement
Sourcepub fn from_bytes(bytes: &[u8; 66]) -> Result<Self>
pub fn from_bytes(bytes: &[u8; 66]) -> Result<Self>
Create a field element from big-endian byte representation.
Validates that the input represents a value less than the field modulus p. Returns an error if the value is >= p.
Source§impl FieldElement
impl FieldElement
Sourcepub fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
pub fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
Constant-time conditional swap
Swaps the two field elements if choice is 1, leaves them unchanged if choice is 0. This operation is performed in constant time to prevent timing attacks.
Trait Implementations§
Source§impl Clone for FieldElement
impl Clone for FieldElement
Source§fn clone(&self) -> FieldElement
fn clone(&self) -> FieldElement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FieldElement
impl Debug for FieldElement
Source§impl PartialEq for FieldElement
impl PartialEq for FieldElement
Source§impl Zeroize for FieldElement
impl Zeroize for FieldElement
impl Eq for FieldElement
impl StructuralPartialEq for FieldElement
Auto Trait Implementations§
impl Freeze for FieldElement
impl RefUnwindSafe for FieldElement
impl Send for FieldElement
impl Sync for FieldElement
impl Unpin for FieldElement
impl UnwindSafe for FieldElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more