Struct unsafe_hacspec_examples::curve25519::Scalar
source · [−]pub struct Scalar(_);
Implementations
sourceimpl Scalar
impl Scalar
pub fn from_canvas(x: ScalarCanvas) -> Scalar
pub fn into_canvas(self) -> ScalarCanvas
pub fn max() -> ScalarCanvas
pub fn declassify(self) -> BigInt
pub fn from_hex(s: &str) -> Self
pub fn from_be_bytes(v: &[u8]) -> Self
pub fn to_be_bytes(self) -> Vec<u8>
pub fn from_le_bytes(v: &[u8]) -> Self
pub fn to_le_bytes(self) -> Vec<u8>
pub fn from_literal(x: u128) -> Self
pub fn from_signed_literal(x: i128) -> Self
pub fn comp_eq(self, rhs: Self) -> Self
pub fn comp_ne(self, rhs: Self) -> Self
pub fn comp_gte(self, rhs: Self) -> Self
pub fn comp_gt(self, rhs: Self) -> Self
pub fn comp_lte(self, rhs: Self) -> Self
pub fn comp_lt(self, rhs: Self) -> Self
sourceimpl Scalar
impl Scalar
pub fn from_byte_seq_be<A: SeqTrait<U8>>(s: &A) -> Scalar
pub fn from_public_byte_seq_be<A: SeqTrait<u8>>(s: A) -> Scalar
pub fn to_byte_seq_be(self) -> Seq<U8>
pub fn to_public_byte_seq_be(self) -> Seq<u8>
pub fn from_byte_seq_le<A: SeqTrait<U8>>(s: A) -> Scalar
pub fn from_public_byte_seq_le<A: SeqTrait<u8>>(s: A) -> Scalar
pub fn to_byte_seq_le(self) -> Seq<U8>
pub fn to_public_byte_seq_le(self) -> Seq<u8>
pub fn from_secret_literal(x: U128) -> Scalar
Trait Implementations
sourceimpl From<ScalarCanvas> for Scalar
impl From<ScalarCanvas> for Scalar
sourcefn from(x: ScalarCanvas) -> Scalar
fn from(x: ScalarCanvas) -> Scalar
Converts to this type from the input type.
sourceimpl Integer for Scalar
impl Integer for Scalar
sourcefn set_bit(self, b: Self, i: usize) -> Self
fn set_bit(self, b: Self, i: usize) -> Self
Set bit i
of this integer to b
and return the result.
Bit b
has to be 0
or 1
.
sourcefn set(self, pos: usize, y: Self, yi: usize) -> Self
fn set(self, pos: usize, y: Self, yi: usize) -> Self
Set bit pos
of this integer to bit yi
of integer y
.
const NUM_BITS: usize = 256usize
fn ZERO() -> Self
fn ONE() -> Self
fn TWO() -> Self
sourcefn from_literal(val: u128) -> Self
fn from_literal(val: u128) -> Self
Get an integer with value val
.
sourcefn from_hex_string(s: &String) -> Self
fn from_hex_string(s: &String) -> Self
Read a hex string (starting with 0x) into an Integer
.
fn rotate_left(self, n: usize) -> Self
fn rotate_right(self, n: usize) -> Self
sourceimpl Into<ScalarCanvas> for Scalar
impl Into<ScalarCanvas> for Scalar
sourcefn into(self) -> ScalarCanvas
fn into(self) -> ScalarCanvas
Converts this type into the (usually inferred) input type.
sourceimpl ModNumeric for Scalar
impl ModNumeric for Scalar
sourcefn signed_modulo(self, n: Self) -> Self
fn signed_modulo(self, n: Self) -> Self
self % n
that always returns a positive integer
sourceimpl Numeric for Scalar
impl Numeric for Scalar
sourcefn inv(self, n: Self) -> Self
fn inv(self, n: Self) -> Self
Invert self modulo n.
NOTE: n
is ignored and inversion is done with respect to
the modulus.
fn wrap_add(self, rhs: Self) -> Self
fn wrap_sub(self, rhs: Self) -> Self
fn wrap_mul(self, rhs: Self) -> Self
fn wrap_div(self, rhs: Self) -> Self
fn equal(self, other: Self) -> bool
fn greater_than(self, other: Self) -> bool
fn greater_than_or_equal(self, other: Self) -> bool
fn less_than(self, other: Self) -> bool
fn less_than_or_equal(self, other: Self) -> bool
fn not_equal_bm(self, other: Self) -> Self
fn equal_bm(self, other: Self) -> Self
fn greater_than_bm(self, other: Self) -> Self
fn greater_than_or_equal_bm(self, other: Self) -> Self
fn less_than_bm(self, other: Self) -> Self
fn less_than_or_equal_bm(self, other: Self) -> Self
sourceimpl Ord for Scalar
impl Ord for Scalar
sourceimpl PartialOrd<Scalar> for Scalar
impl PartialOrd<Scalar> for Scalar
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Scalar
impl Eq for Scalar
impl NumericCopy for Scalar
impl UnsignedInteger for Scalar
impl UnsignedIntegerCopy for Scalar
Auto Trait Implementations
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnwindSafe for Scalar
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more