pub struct SecretBuffer<S> { /* private fields */ }
Available on crate feature
xxhash3_64
only.Expand description
Holds secret and temporary buffers that are ensured to be appropriately sized.
Implementations§
Source§impl SecretBuffer<Box<[u8]>>
impl SecretBuffer<Box<[u8]>>
Sourcepub fn allocate_default() -> Self
Available on crate feature alloc
only.
pub fn allocate_default() -> Self
alloc
only.Allocates the secret and temporary buffers and fills them with the default seed and secret values.
Sourcepub fn allocate_with_seed(seed: u64) -> Self
Available on crate feature alloc
only.
pub fn allocate_with_seed(seed: u64) -> Self
alloc
only.Allocates the secret and temporary buffers and uses the provided seed to construct the secret value.
Sourcepub fn allocate_with_seed_and_secret(
seed: u64,
secret: impl Into<Box<[u8]>>,
) -> Result<Self, SecretTooShortError<Box<[u8]>>>
Available on crate feature alloc
only.
pub fn allocate_with_seed_and_secret( seed: u64, secret: impl Into<Box<[u8]>>, ) -> Result<Self, SecretTooShortError<Box<[u8]>>>
alloc
only.Allocates the temporary buffer and uses the provided seed and secret buffer.
Source§impl<S> SecretBuffer<S>where
S: FixedBuffer,
impl<S> SecretBuffer<S>where
S: FixedBuffer,
Sourcepub fn new(seed: u64, secret: S) -> Result<Self, SecretTooShortError<S>>
pub fn new(seed: u64, secret: S) -> Result<Self, SecretTooShortError<S>>
Takes the seed, secret, and buffer and performs no modifications to them, only validating that the sizes are appropriate.
Source§impl<S> SecretBuffer<S>
impl<S> SecretBuffer<S>
Sourcepub fn into_secret(self) -> S
pub fn into_secret(self) -> S
Returns the secret.
Source§impl SecretBuffer<&'static [u8; 192]>
impl SecretBuffer<&'static [u8; 192]>
Source§impl<S> SecretBuffer<S>where
S: FixedMutBuffer,
impl<S> SecretBuffer<S>where
S: FixedMutBuffer,
Sourcepub fn with_seed(seed: u64, secret: S) -> Result<Self, SecretWithSeedError<S>>
pub fn with_seed(seed: u64, secret: S) -> Result<Self, SecretWithSeedError<S>>
Fills the secret buffer with a secret derived from the seed
and the default secret. The secret must be exactly
DEFAULT_SECRET_LENGTH
bytes long.
Trait Implementations§
Source§impl<S: Clone> Clone for SecretBuffer<S>
impl<S: Clone> Clone for SecretBuffer<S>
Source§fn clone(&self) -> SecretBuffer<S>
fn clone(&self) -> SecretBuffer<S>
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 moreAuto Trait Implementations§
impl<S> Freeze for SecretBuffer<S>where
S: Freeze,
impl<S> RefUnwindSafe for SecretBuffer<S>where
S: RefUnwindSafe,
impl<S> Send for SecretBuffer<S>where
S: Send,
impl<S> Sync for SecretBuffer<S>where
S: Sync,
impl<S> Unpin for SecretBuffer<S>where
S: Unpin,
impl<S> UnwindSafe for SecretBuffer<S>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)