pub struct U64(pub u64);
Tuple Fields§
§0: u64
Implementations§
Source§impl U64
impl U64
pub fn classify<T>(x: T) -> U64
Sourcepub fn declassify(self) -> u64
pub fn declassify(self) -> u64
Warning: use with caution, breaks the constant-time guarantee.
pub fn zero() -> U64
pub fn one() -> U64
pub fn ones() -> U64
pub fn from_le_bytes(bytes: &[U8]) -> Vec<U64>
pub fn to_le_bytes(ints: &[U64]) -> Vec<U8>
pub fn from_be_bytes(bytes: &[U8]) -> Vec<U64>
pub fn to_be_bytes(ints: &[U64]) -> Vec<U8>
pub fn max_value() -> U64
Source§impl U64
impl U64
pub fn rotate_left(self, rotval: usize) -> U64
pub fn rotate_right(self, rotval: usize) -> U64
Source§impl U64
§Constant-time comparison operators
impl U64
§Constant-time comparison operators
Sourcepub fn comp_eq(self, rhs: U64) -> U64
pub fn comp_eq(self, rhs: U64) -> U64
Produces a new integer which is all ones if the two arguments are equal and all zeroes otherwise. With inspiration from Wireguard.
Sourcepub fn comp_ne(self, rhs: U64) -> U64
pub fn comp_ne(self, rhs: U64) -> U64
Produces a new integer which is all ones if the first argument is different from the second argument, and all zeroes otherwise.
Sourcepub fn comp_gte(self, rhs: U64) -> U64
pub fn comp_gte(self, rhs: U64) -> U64
Produces a new integer which is all ones if the first argument is greater than or equal to the second argument, and all zeroes otherwise. With inspiration from WireGuard.
Sourcepub fn comp_gt(self, rhs: U64) -> U64
pub fn comp_gt(self, rhs: U64) -> U64
Produces a new integer which is all ones if the first argument is strictly greater than the second argument, and all zeroes otherwise.
Trait Implementations§
Source§impl AddAssign for U64
Warning: has wrapping semantics.
impl AddAssign for U64
Warning: has wrapping semantics.
Source§fn add_assign(&mut self, rhs: U64)
fn add_assign(&mut self, rhs: U64)
+=
operation. Read moreSource§impl BitAndAssign for U64
impl BitAndAssign for U64
Source§fn bitand_assign(&mut self, rhs: U64)
fn bitand_assign(&mut self, rhs: U64)
&=
operation. Read moreSource§impl BitOrAssign for U64
impl BitOrAssign for U64
Source§fn bitor_assign(&mut self, rhs: U64)
fn bitor_assign(&mut self, rhs: U64)
|=
operation. Read moreSource§impl BitXorAssign for U64
impl BitXorAssign for U64
Source§fn bitxor_assign(&mut self, rhs: U64)
fn bitxor_assign(&mut self, rhs: U64)
^=
operation. Read moreSource§impl Integer for U64
impl Integer for U64
Source§fn 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
.
Source§fn 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 = 64usize
fn ZERO() -> Self
fn ONE() -> Self
fn TWO() -> Self
Source§fn from_literal(val: u128) -> Self
fn from_literal(val: u128) -> Self
val
.Source§fn from_hex_string(s: &String) -> Self
fn from_hex_string(s: &String) -> Self
Integer
.fn rotate_left(self, n: usize) -> Self
fn rotate_right(self, n: usize) -> Self
Source§impl ModNumeric for U64
impl ModNumeric for U64
Source§fn signed_modulo(self, n: Self) -> Self
fn signed_modulo(self, n: Self) -> Self
self % n
that always returns a positive integer
Source§impl MulAssign for U64
Warning: has wrapping semantics.
impl MulAssign for U64
Warning: has wrapping semantics.
Source§fn mul_assign(&mut self, rhs: U64)
fn mul_assign(&mut self, rhs: U64)
*=
operation. Read moreSource§impl Numeric for U64
impl Numeric for U64
Source§fn exp(self, exp: u32) -> Self
fn exp(self, exp: u32) -> Self
self ^ exp
where exp
is a u32
.
Note: the exponent exp
MUST NOT be secret.
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
Here both, base and exponent, are secret.
TODO: implement
Source§fn greater_than(self, other: Self) -> bool
fn greater_than(self, other: Self) -> bool
Declassifies
Source§fn greater_than_or_equal(self, other: Self) -> bool
fn greater_than_or_equal(self, other: Self) -> bool
Declassifies
Source§fn less_than_or_equal(self, other: Self) -> bool
fn less_than_or_equal(self, other: Self) -> bool
Declassifies
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 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
Source§impl SecretInteger for U64
impl SecretInteger for U64
type PublicVersion = u64
fn classify(x: Self::PublicVersion) -> Self
Source§impl SecretIntegerCopy for U64
impl SecretIntegerCopy for U64
type PublicVersionCopy = u64
fn classify(x: Self::PublicVersionCopy) -> Self
Source§impl ShlAssign<usize> for U64
impl ShlAssign<usize> for U64
Source§fn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
<<=
operation. Read moreSource§impl ShrAssign<usize> for U64
impl ShrAssign<usize> for U64
Source§fn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
>>=
operation. Read moreSource§impl SubAssign for U64
Warning: has wrapping semantics.
impl SubAssign for U64
Warning: has wrapping semantics.
Source§fn sub_assign(&mut self, rhs: U64)
fn sub_assign(&mut self, rhs: U64)
-=
operation. Read more