Struct bonsaidb::local::argon2::password_hash::SaltString
pub struct SaltString { /* private fields */ }
Expand description
Owned stack-allocated equivalent of Salt
.
Implementations§
§impl SaltString
impl SaltString
pub fn generate(rng: impl CryptoRngCore) -> SaltString
pub fn generate(rng: impl CryptoRngCore) -> SaltString
Generate a random B64-encoded SaltString
.
pub fn from_b64(s: &str) -> Result<SaltString, Error>
pub fn from_b64(s: &str) -> Result<SaltString, Error>
Create a new SaltString
from the given B64-encoded input string,
validating Salt::MIN_LENGTH
and Salt::MAX_LENGTH
restrictions.
pub fn decode_b64<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
pub fn decode_b64<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Decode this SaltString
from B64 into the provided output buffer.
pub fn encode_b64(input: &[u8]) -> Result<SaltString, Error>
pub fn encode_b64(input: &[u8]) -> Result<SaltString, Error>
Encode the given byte slice as B64 into a new SaltString
.
Returns Error
if the slice is too long.
pub fn as_salt(&self) -> Salt<'_>
pub fn as_salt(&self) -> Salt<'_>
Borrow the contents of a SaltString
as a Salt
.
pub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Borrow the contents of a SaltString
as a str
.
pub fn new(s: &str) -> Result<SaltString, Error>
👎Deprecated since 0.5.0: use from_b64
instead
pub fn new(s: &str) -> Result<SaltString, Error>
from_b64
insteadCreate a new SaltString
from the given B64-encoded input string,
validating Salt::MIN_LENGTH
and Salt::MAX_LENGTH
restrictions.
pub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
👎Deprecated since 0.5.0: use decode_b64
instead
pub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
decode_b64
insteadDecode this SaltString
from B64 into the provided output buffer.
pub fn b64_encode(input: &[u8]) -> Result<SaltString, Error>
👎Deprecated since 0.5.0: use encode_b64
instead
pub fn b64_encode(input: &[u8]) -> Result<SaltString, Error>
encode_b64
insteadEncode the given byte slice as B64 into a new SaltString
.
Returns Error
if the slice is too long.
Trait Implementations§
§impl AsRef<str> for SaltString
impl AsRef<str> for SaltString
§impl Clone for SaltString
impl Clone for SaltString
§fn clone(&self) -> SaltString
fn clone(&self) -> SaltString
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for SaltString
impl Debug for SaltString
§impl Display for SaltString
impl Display for SaltString
§impl<'a> From<&'a SaltString> for Salt<'a>
impl<'a> From<&'a SaltString> for Salt<'a>
§fn from(salt_string: &'a SaltString) -> Salt<'a>
fn from(salt_string: &'a SaltString) -> Salt<'a>
Converts to this type from the input type.
§impl PartialEq for SaltString
impl PartialEq for SaltString
§fn eq(&self, other: &SaltString) -> bool
fn eq(&self, other: &SaltString) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.