pub struct Salt { /* private fields */ }
Available on crate feature
safe_api
only.Expand description
A type to represent the Salt
that Argon2i uses during key derivation.
As default it will randomly generate a Salt
of 16 bytes.
Errors:
An error will be returned if:
slice
is empty.length
is 0.length
is not less thanisize::MAX
.
Panics:
A panic will occur if:
- Failure to generate random bytes securely.
Implementations§
source§impl Salt
impl Salt
sourcepub fn from_slice(slice: &[u8]) -> Result<Salt, UnknownCryptoError>
pub fn from_slice(slice: &[u8]) -> Result<Salt, UnknownCryptoError>
Construct from a given byte slice.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Salt
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for Salt
Available on crate feature
serde
only.This type tries to deserialize as a Vec<u8>
would. If it succeeds, the digest
will be built using Self::from_slice
.
Note that this allocates once to store the referenced bytes on the heap.
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<&[u8]> for Salt
impl PartialEq<&[u8]> for Salt
source§impl PartialEq<Salt> for Salt
impl PartialEq<Salt> for Salt
source§impl Serialize for Salt
Available on crate feature serde
only.
impl Serialize for Salt
Available on crate feature
serde
only.This type tries to serialize as a &[u8]
would. Note that the serialized
type likely does not have the same protections that Orion provides, such
as constant-time operations. A good rule of thumb is to only serialize
these types for storage. Don’t operate on the serialized types.
impl Eq for Salt
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more