Struct bc_components::Salt
source · pub struct Salt(_);
Expand description
Random salt used to decorrelate other information.
Implementations§
source§impl Salt
impl Salt
sourcepub fn from_data_ref<T>(data: &T) -> Selfwhere
T: AsRef<[u8]>,
pub fn from_data_ref<T>(data: &T) -> Selfwhere T: AsRef<[u8]>,
Create a new salt from data.
sourcepub fn new_with_len(count: usize) -> Option<Self>
pub fn new_with_len(count: usize) -> Option<Self>
Create a specific number of bytes of salt.
If the number of bytes is less than 8, this will return None
.
sourcepub fn new_with_len_using<R>(count: usize, rng: &mut R) -> Option<Self>where
R: RandomNumberGenerator,
pub fn new_with_len_using<R>(count: usize, rng: &mut R) -> Option<Self>where R: RandomNumberGenerator,
Create a specific number of bytes of salt.
If the number of bytes is less than 8, this will return None
.
sourcepub fn new_in_range(range: RangeInclusive<usize>) -> Option<Self>
pub fn new_in_range(range: RangeInclusive<usize>) -> Option<Self>
Create a number of bytes of salt chosen randomly from the given range.
If the minimum number of bytes is less than 8, this will return None
.
sourcepub fn new_in_range_using<R>(
range: &RangeInclusive<usize>,
rng: &mut R
) -> Option<Self>where
R: RandomNumberGenerator,
pub fn new_in_range_using<R>( range: &RangeInclusive<usize>, rng: &mut R ) -> Option<Self>where R: RandomNumberGenerator,
Create a number of bytes of salt chosen randomly from the given range.
If the minimum number of bytes is less than 8, this will return None
.
sourcepub fn new_for_size(size: usize) -> Self
pub fn new_for_size(size: usize) -> Self
Create a number of bytes of salt generally proportionate to the size of the object being salted.
sourcepub fn new_for_size_using<R>(size: usize, rng: &mut R) -> Selfwhere
R: RandomNumberGenerator,
pub fn new_for_size_using<R>(size: usize, rng: &mut R) -> Selfwhere R: RandomNumberGenerator,
Create a number of bytes of salt generally proportionate to the size of the object being salted.