pub struct Salt { /* private fields */ }
Expand description
A type to represent the Salt
that PBKDF2 uses during key derivation.
As default it will randomly generate a Salt
of 64 bytes.
Note:
Due to the return type of the Default trait, the default()
method cannot let the caller
handle a failing CSPRNG. If the CSPRNG fails, that function panics. If handling a failing CSPRNG’s
error is needed, use instead generate()
.
Exceptions:
An exception will be thrown if:
slice
is empty.- The
OsRng
fails to initialize or read from its source. length
is 0.length
is not less thanu32::max_value()
.
Implementations§
source§impl Salt
impl Salt
sourcepub fn from_slice(slice: &[u8]) -> Result<Salt, UnknownCryptoError>
pub fn from_slice(slice: &[u8]) -> Result<Salt, UnknownCryptoError>
Make an object from a given byte slice.
sourcepub fn get_length(&self) -> usize
pub fn get_length(&self) -> usize
Return the length of the object.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Salt
impl Send for Salt
impl Sync for Salt
impl Unpin for Salt
impl UnwindSafe for Salt
Blanket Implementations§
source§impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
source§impl<T> InitializableFromZeroed for Twhere
T: Default,
impl<T> InitializableFromZeroed for Twhere
T: Default,
source§unsafe fn initialize(place: *mut T)
unsafe fn initialize(place: *mut T)
Called to initialize a place to a valid value, after it is set
to all-bits-zero. Read more