pub struct U8(pub u8);
Tuple Fields§
§0: u8
Implementations§
Source§impl U8
impl U8
pub fn classify<T>(x: T) -> U8
Sourcepub fn declassify(self) -> u8
pub fn declassify(self) -> u8
Warning: use with caution, breaks the constant-time guarantee.
pub fn zero() -> U8
pub fn one() -> U8
pub fn ones() -> U8
pub fn from_le_bytes(bytes: &[U8]) -> Vec<U8>
pub fn to_le_bytes(ints: &[U8]) -> Vec<U8>
pub fn from_be_bytes(bytes: &[U8]) -> Vec<U8>
pub fn to_be_bytes(ints: &[U8]) -> Vec<U8>
pub fn max_value() -> U8
Source§impl U8
impl U8
pub fn rotate_left(self, rotval: usize) -> U8
pub fn rotate_right(self, rotval: usize) -> U8
Source§impl U8
§Constant-time comparison operators
impl U8
§Constant-time comparison operators
Sourcepub fn comp_eq(self, rhs: U8) -> U8
pub fn comp_eq(self, rhs: U8) -> U8
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: U8) -> U8
pub fn comp_ne(self, rhs: U8) -> U8
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: U8) -> U8
pub fn comp_gte(self, rhs: U8) -> U8
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: U8) -> U8
pub fn comp_gt(self, rhs: U8) -> U8
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 U8
Warning: has wrapping semantics.
impl AddAssign for U8
Warning: has wrapping semantics.
Source§fn add_assign(&mut self, rhs: U8)
fn add_assign(&mut self, rhs: U8)
+=
operation. Read moreSource§impl BitAndAssign for U8
impl BitAndAssign for U8
Source§fn bitand_assign(&mut self, rhs: U8)
fn bitand_assign(&mut self, rhs: U8)
&=
operation. Read moreSource§impl BitOrAssign for U8
impl BitOrAssign for U8
Source§fn bitor_assign(&mut self, rhs: U8)
fn bitor_assign(&mut self, rhs: U8)
|=
operation. Read moreSource§impl BitXorAssign for U8
impl BitXorAssign for U8
Source§fn bitxor_assign(&mut self, rhs: U8)
fn bitxor_assign(&mut self, rhs: U8)
^=
operation. Read moreSource§impl Integer for U8
impl Integer for U8
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 = 8usize
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 U8
impl ModNumeric for U8
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 U8
Warning: has wrapping semantics.
impl MulAssign for U8
Warning: has wrapping semantics.
Source§fn mul_assign(&mut self, rhs: U8)
fn mul_assign(&mut self, rhs: U8)
*=
operation. Read moreSource§impl Numeric for U8
impl Numeric for U8
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 U8
impl SecretInteger for U8
type PublicVersion = u8
fn classify(x: Self::PublicVersion) -> Self
Source§impl SecretIntegerCopy for U8
impl SecretIntegerCopy for U8
type PublicVersionCopy = u8
fn classify(x: Self::PublicVersionCopy) -> Self
Source§impl SeqTrait<U8> for U128Word
impl SeqTrait<U8> for U128Word
fn create(x: usize) -> Self
fn len(&self) -> usize
fn iter(&self) -> Iter<'_, U8>
Source§fn update_slice<A: SeqTrait<U8>>(
self,
start_out: usize,
v: &A,
start_in: usize,
len: usize,
) -> Self
fn update_slice<A: SeqTrait<U8>>( self, start_out: usize, v: &A, start_in: usize, len: usize, ) -> Self
fn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
Source§impl SeqTrait<U8> for U16Word
impl SeqTrait<U8> for U16Word
fn create(x: usize) -> Self
fn len(&self) -> usize
fn iter(&self) -> Iter<'_, U8>
Source§fn update_slice<A: SeqTrait<U8>>(
self,
start_out: usize,
v: &A,
start_in: usize,
len: usize,
) -> Self
fn update_slice<A: SeqTrait<U8>>( self, start_out: usize, v: &A, start_in: usize, len: usize, ) -> Self
fn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
Source§impl SeqTrait<U8> for U32Word
impl SeqTrait<U8> for U32Word
fn create(x: usize) -> Self
fn len(&self) -> usize
fn iter(&self) -> Iter<'_, U8>
Source§fn update_slice<A: SeqTrait<U8>>(
self,
start_out: usize,
v: &A,
start_in: usize,
len: usize,
) -> Self
fn update_slice<A: SeqTrait<U8>>( self, start_out: usize, v: &A, start_in: usize, len: usize, ) -> Self
fn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
Source§impl SeqTrait<U8> for U64Word
impl SeqTrait<U8> for U64Word
fn create(x: usize) -> Self
fn len(&self) -> usize
fn iter(&self) -> Iter<'_, U8>
Source§fn update_slice<A: SeqTrait<U8>>(
self,
start_out: usize,
v: &A,
start_in: usize,
len: usize,
) -> Self
fn update_slice<A: SeqTrait<U8>>( self, start_out: usize, v: &A, start_in: usize, len: usize, ) -> Self
fn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
Source§impl ShlAssign<usize> for U8
impl ShlAssign<usize> for U8
Source§fn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
<<=
operation. Read moreSource§impl ShrAssign<usize> for U8
impl ShrAssign<usize> for U8
Source§fn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
>>=
operation. Read moreSource§impl SubAssign for U8
Warning: has wrapping semantics.
impl SubAssign for U8
Warning: has wrapping semantics.
Source§fn sub_assign(&mut self, rhs: U8)
fn sub_assign(&mut self, rhs: U8)
-=
operation. Read more