Struct password_hash::SaltString
source · [−]pub struct SaltString { /* private fields */ }
Expand description
Owned stack-allocated equivalent of Salt
.
Implementations
sourceimpl SaltString
impl SaltString
sourcepub fn generate(rng: impl CryptoRng + RngCore) -> Self
Available on crate feature rand_core
only.
pub fn generate(rng: impl CryptoRng + RngCore) -> Self
rand_core
only.Generate a random B64-encoded SaltString
.
sourcepub fn new(s: &str) -> Result<Self>
pub fn new(s: &str) -> Result<Self>
Create a new SaltString
.
sourcepub fn b64_encode(input: &[u8]) -> Result<Self>
pub fn b64_encode(input: &[u8]) -> Result<Self>
Encode the given byte slice as B64 into a new SaltString
.
Returns None
if the slice is too long.
sourcepub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
pub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
Decode this SaltString
from B64 into the provided output buffer.
sourcepub fn as_salt(&self) -> Salt<'_>
pub fn as_salt(&self) -> Salt<'_>
Borrow the contents of a SaltString
as a Salt
.
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Borrow the contents of a SaltString
as a str
.
Trait Implementations
sourceimpl AsRef<str> for SaltString
impl AsRef<str> for SaltString
sourceimpl Clone for SaltString
impl Clone for SaltString
sourcefn clone(&self) -> SaltString
fn clone(&self) -> SaltString
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SaltString
impl Debug for SaltString
sourceimpl Display for SaltString
impl Display for SaltString
sourceimpl<'a> From<&'a SaltString> for Salt<'a>
impl<'a> From<&'a SaltString> for Salt<'a>
sourcefn from(salt_string: &'a SaltString) -> Salt<'a>
fn from(salt_string: &'a SaltString) -> Salt<'a>
Converts to this type from the input type.
sourceimpl PartialEq<SaltString> for SaltString
impl PartialEq<SaltString> for SaltString
impl Eq for SaltString
impl StructuralEq for SaltString
Auto Trait Implementations
impl RefUnwindSafe for SaltString
impl Send for SaltString
impl Sync for SaltString
impl Unpin for SaltString
impl UnwindSafe for SaltString
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