Struct password_hash::SaltString
source · pub struct SaltString { /* private fields */ }Expand description
Owned stack-allocated equivalent of Salt.
Implementations§
source§impl SaltString
impl SaltString
sourcepub fn generate(rng: impl CryptoRngCore) -> Self
Available on crate feature rand_core only.
pub fn generate(rng: impl CryptoRngCore) -> Self
rand_core only.Generate a random B64-encoded SaltString.
sourcepub fn from_b64(s: &str) -> Result<Self>
pub fn from_b64(s: &str) -> Result<Self>
Create a new SaltString from the given B64-encoded input string,
validating Salt::MIN_LENGTH and Salt::MAX_LENGTH restrictions.
sourcepub fn decode_b64<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
pub fn decode_b64<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
Decode this SaltString from B64 into the provided output buffer.
sourcepub fn encode_b64(input: &[u8]) -> Result<Self>
pub fn encode_b64(input: &[u8]) -> Result<Self>
Encode the given byte slice as B64 into a new SaltString.
Returns Error if the slice is too long.
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.
sourcepub fn new(s: &str) -> Result<Self>
👎Deprecated since 0.5.0: use from_b64 instead
pub fn new(s: &str) -> Result<Self>
from_b64 insteadCreate a new SaltString from the given B64-encoded input string,
validating Salt::MIN_LENGTH and Salt::MAX_LENGTH restrictions.
sourcepub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
👎Deprecated since 0.5.0: use decode_b64 instead
pub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
decode_b64 insteadDecode this SaltString from B64 into the provided output buffer.
sourcepub fn b64_encode(input: &[u8]) -> Result<Self>
👎Deprecated since 0.5.0: use encode_b64 instead
pub fn b64_encode(input: &[u8]) -> Result<Self>
encode_b64 insteadEncode the given byte slice as B64 into a new SaltString.
Returns Error if the slice is too long.
Trait Implementations§
source§impl AsRef<str> for SaltString
impl AsRef<str> for SaltString
source§impl Clone for SaltString
impl Clone for SaltString
source§fn clone(&self) -> SaltString
fn clone(&self) -> SaltString
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for SaltString
impl Debug for SaltString
source§impl Display for SaltString
impl Display for SaltString
source§impl<'a> From<&'a SaltString> for Salt<'a>
impl<'a> From<&'a SaltString> for Salt<'a>
source§fn from(salt_string: &'a SaltString) -> Salt<'a>
fn from(salt_string: &'a SaltString) -> Salt<'a>
source§impl PartialEq for SaltString
impl PartialEq for SaltString
impl Eq for SaltString
Auto Trait Implementations§
impl Freeze for SaltString
impl RefUnwindSafe for SaltString
impl Send for SaltString
impl Sync for SaltString
impl Unpin for SaltString
impl UnwindSafe for SaltString
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 65 bytes