Struct hacspec_lib::prelude::U8
source · [−]pub struct U8(pub u8);
Tuple Fields
0: u8
Implementations
sourceimpl U8
impl U8
pub fn classify<T>(x: T) -> U8 where
T: Into<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, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn to_le_bytes(ints: &[U8]) -> Vec<U8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn from_be_bytes(bytes: &[U8]) -> Vec<U8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn to_be_bytes(ints: &[U8]) -> Vec<U8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn max_value() -> U8
sourceimpl U8
impl U8
pub fn rotate_left(self, rotval: usize) -> U8
pub fn rotate_right(self, rotval: usize) -> U8
sourceimpl U8
impl U8
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
sourceimpl AddAssign<U8> for U8
impl AddAssign<U8> for U8
Warning: has wrapping semantics.
sourcefn add_assign(&mut self, rhs: U8)
fn add_assign(&mut self, rhs: U8)
Performs the +=
operation. Read more
sourceimpl BitAndAssign<U8> for U8
impl BitAndAssign<U8> for U8
sourcefn bitand_assign(&mut self, rhs: U8)
fn bitand_assign(&mut self, rhs: U8)
Performs the &=
operation. Read more
sourceimpl BitOrAssign<U8> for U8
impl BitOrAssign<U8> for U8
sourcefn bitor_assign(&mut self, rhs: U8)
fn bitor_assign(&mut self, rhs: U8)
Performs the |=
operation. Read more
sourceimpl BitXorAssign<U8> for U8
impl BitXorAssign<U8> for U8
sourcefn bitxor_assign(&mut self, rhs: U8)
fn bitxor_assign(&mut self, rhs: U8)
Performs the ^=
operation. Read more
sourceimpl Integer for U8
impl Integer for U8
sourcefn ZERO() -> Self
fn ZERO() -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn ONE() -> Self
fn ONE() -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn TWO() -> Self
fn TWO() -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn from_literal(val: u128) -> Self
fn from_literal(val: u128) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn from_hex_string(s: &String) -> Self
fn from_hex_string(s: &String) -> Self
This function can be called from hacspec programs but its body features Rust constructs that are not part of hacspec
sourcefn get_bit(self, i: usize) -> Self
fn get_bit(self, i: usize) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
Get bit i
of this integer.
sourcefn set_bit(self, b: Self, i: usize) -> Self
fn set_bit(self, b: Self, i: usize) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
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
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
Set bit pos
of this integer to bit yi
of integer y
.
sourcefn rotate_left(self, n: usize) -> Self
fn rotate_left(self, n: usize) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn rotate_right(self, n: usize) -> Self
fn rotate_right(self, n: usize) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
const NUM_BITS: usize = 8usize
sourceimpl ModNumeric for U8
impl ModNumeric for U8
sourcefn sub_mod(self, rhs: Self, n: Self) -> Self
fn sub_mod(self, rhs: Self, n: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec. (self - rhs) % n.
sourcefn add_mod(self, rhs: Self, n: Self) -> Self
fn add_mod(self, rhs: Self, n: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
(self + rhs) % n
sourcefn mul_mod(self, rhs: Self, n: Self) -> Self
fn mul_mod(self, rhs: Self, n: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
(self * rhs) % n
sourcefn pow_mod(self, _exp: Self, _n: Self) -> Self
fn pow_mod(self, _exp: Self, _n: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
(self ^ exp) % n
TODO: implement
sourcefn modulo(self, n: Self) -> Self
fn modulo(self, n: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
self % n
sourcefn signed_modulo(self, n: Self) -> Self
fn signed_modulo(self, n: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
self % n
that always returns a positive integer
sourceimpl MulAssign<U8> for U8
impl MulAssign<U8> for U8
Warning: has wrapping semantics.
sourcefn mul_assign(&mut self, rhs: U8)
fn mul_assign(&mut self, rhs: U8)
Performs the *=
operation. Read more
sourceimpl Numeric for U8
impl Numeric for U8
sourcefn max_val() -> Self
fn max_val() -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec. Return largest value that can be represented.
sourcefn wrap_add(self, rhs: Self) -> Self
fn wrap_add(self, rhs: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn wrap_sub(self, rhs: Self) -> Self
fn wrap_sub(self, rhs: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn wrap_mul(self, rhs: Self) -> Self
fn wrap_mul(self, rhs: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn wrap_div(self, _rhs: Self) -> Self
fn wrap_div(self, _rhs: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn exp(self, exp: u32) -> Self
fn exp(self, exp: u32) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
self ^ exp
where exp
is a u32
.
Note: the exponent exp
MUST NOT be secret.
sourcefn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and
call functions whose signatures are in hacspec.
self ^ exp
where exp
is a Self
.
Here both, base and exponent, are secret.
TODO: implement
sourcefn divide(self, rhs: Self) -> Self
fn divide(self, rhs: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec. Division.
sourcefn inv(self, n: Self) -> Self
fn inv(self, n: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec. Invert self modulo n. FIXME: make ct
sourcefn equal(self, other: Self) -> bool
fn equal(self, other: Self) -> bool
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec. Declassifies
sourcefn greater_than(self, other: Self) -> bool
fn greater_than(self, other: Self) -> bool
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec. Declassifies
sourcefn greater_than_or_equal(self, other: Self) -> bool
fn greater_than_or_equal(self, other: Self) -> bool
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec. Declassifies
sourcefn less_than(self, other: Self) -> bool
fn less_than(self, other: Self) -> bool
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec. Declassifies
sourcefn less_than_or_equal(self, other: Self) -> bool
fn less_than_or_equal(self, other: Self) -> bool
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec. Declassifies
sourcefn not_equal_bm(self, other: Self) -> Self
fn not_equal_bm(self, other: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn equal_bm(self, other: Self) -> Self
fn equal_bm(self, other: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn greater_than_bm(self, other: Self) -> Self
fn greater_than_bm(self, other: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn greater_than_or_equal_bm(self, other: Self) -> Self
fn greater_than_or_equal_bm(self, other: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn less_than_bm(self, other: Self) -> Self
fn less_than_bm(self, other: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn less_than_or_equal_bm(self, other: Self) -> Self
fn less_than_or_equal_bm(self, other: Self) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourceimpl SecretInteger for U8
impl SecretInteger for U8
sourcefn classify(x: Self::PublicVersion) -> Self
fn classify(x: Self::PublicVersion) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
type PublicVersion = u8
sourceimpl SecretIntegerCopy for U8
impl SecretIntegerCopy for U8
type PublicVersionCopy = u8
fn classify(x: Self::PublicVersionCopy) -> Self
sourceimpl SeqTrait<U8> for U16Word
impl SeqTrait<U8> for U16Word
sourcefn create(x: usize) -> Self
fn create(x: usize) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn len(&self) -> usize
fn len(&self) -> usize
This function can be called from hacspec programs but its body features Rust constructs that are not part of hacspec
sourcefn iter(&self) -> Iter<'_, U8>
fn iter(&self) -> Iter<'_, U8>
Function that is not part of the language but is offered as a helper for tests, etc.
sourcefn 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
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn update<A: SeqTrait<U8>>(self, start: usize, v: &A) -> Self
fn update<A: SeqTrait<U8>>(self, start: usize, v: &A) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
fn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourceimpl SeqTrait<U8> for U32Word
impl SeqTrait<U8> for U32Word
sourcefn create(x: usize) -> Self
fn create(x: usize) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn len(&self) -> usize
fn len(&self) -> usize
This function can be called from hacspec programs but its body features Rust constructs that are not part of hacspec
sourcefn iter(&self) -> Iter<'_, U8>
fn iter(&self) -> Iter<'_, U8>
Function that is not part of the language but is offered as a helper for tests, etc.
sourcefn 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
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn update<A: SeqTrait<U8>>(self, start: usize, v: &A) -> Self
fn update<A: SeqTrait<U8>>(self, start: usize, v: &A) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
fn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourceimpl SeqTrait<U8> for U64Word
impl SeqTrait<U8> for U64Word
sourcefn create(x: usize) -> Self
fn create(x: usize) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn len(&self) -> usize
fn len(&self) -> usize
This function can be called from hacspec programs but its body features Rust constructs that are not part of hacspec
sourcefn iter(&self) -> Iter<'_, U8>
fn iter(&self) -> Iter<'_, U8>
Function that is not part of the language but is offered as a helper for tests, etc.
sourcefn 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
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn update<A: SeqTrait<U8>>(self, start: usize, v: &A) -> Self
fn update<A: SeqTrait<U8>>(self, start: usize, v: &A) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
fn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourceimpl SeqTrait<U8> for U128Word
impl SeqTrait<U8> for U128Word
sourcefn create(x: usize) -> Self
fn create(x: usize) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn len(&self) -> usize
fn len(&self) -> usize
This function can be called from hacspec programs but its body features Rust constructs that are not part of hacspec
sourcefn iter(&self) -> Iter<'_, U8>
fn iter(&self) -> Iter<'_, U8>
Function that is not part of the language but is offered as a helper for tests, etc.
sourcefn 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
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn update<A: SeqTrait<U8>>(self, start: usize, v: &A) -> Self
fn update<A: SeqTrait<U8>>(self, start: usize, v: &A) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
fn update_start<A: SeqTrait<U8>>(self, v: &A) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourceimpl ShlAssign<usize> for U8
impl ShlAssign<usize> for U8
sourcefn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
Performs the <<=
operation. Read more
sourceimpl ShrAssign<usize> for U8
impl ShrAssign<usize> for U8
sourcefn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
Performs the >>=
operation. Read more
sourceimpl SubAssign<U8> for U8
impl SubAssign<U8> for U8
Warning: has wrapping semantics.
sourcefn sub_assign(&mut self, rhs: U8)
fn sub_assign(&mut self, rhs: U8)
Performs the -=
operation. Read more
sourceimpl UnsignedSecretInteger for U8
impl UnsignedSecretInteger for U8
sourcefn to_le_bytes(self) -> Seq<U8>
fn to_le_bytes(self) -> Seq<U8>
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn to_be_bytes(self) -> Seq<U8>
fn to_be_bytes(self) -> Seq<U8>
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn from_le_bytes(x: &Seq<U8>) -> Self
fn from_le_bytes(x: &Seq<U8>) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
sourcefn from_be_bytes(x: &Seq<U8>) -> Self
fn from_be_bytes(x: &Seq<U8>) -> Self
This function is within the hacspec subset of Rust: its signature and body use only hacspec constructs and call functions whose signatures are in hacspec.
impl Copy for U8
impl NumericCopy for U8
impl UnsignedInteger for U8
impl UnsignedIntegerCopy for U8
impl UnsignedSecretIntegerCopy for U8
Auto Trait Implementations
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