pub struct BufferSet<Q: AsRef<[Align64<Block<R>>]> + AsMut<[Align64<Block<R>>]>, R: ArrayLength + NonZero> { /* private fields */ }
Expand description
Scrypt with a fixed R value
Implementations§
Source§impl<R: ArrayLength + NonZero> BufferSet<MaybeHugeSlice<Align64<Block<R>>>, R>
impl<R: ArrayLength + NonZero> BufferSet<MaybeHugeSlice<Align64<Block<R>>>, R>
Sourcepub fn new_maybe_huge_slice(
cf: NonZeroU8,
) -> BufferSet<MaybeHugeSlice<Align64<Block<R>>>, R>
pub fn new_maybe_huge_slice( cf: NonZeroU8, ) -> BufferSet<MaybeHugeSlice<Align64<Block<R>>>, R>
Create a new buffer set in a huge page with a given Cost Factor (log2(N))
Sourcepub fn new_maybe_huge_slice_ex(
cf: NonZeroU8,
) -> (BufferSet<MaybeHugeSlice<Align64<Block<R>>>, R>, Option<Error>)
pub fn new_maybe_huge_slice_ex( cf: NonZeroU8, ) -> (BufferSet<MaybeHugeSlice<Align64<Block<R>>>, R>, Option<Error>)
Create a new buffer set in a huge page with a given Cost Factor (log2(N))
Source§impl<Q: AsRef<[Align64<Block<R>>]> + AsMut<[Align64<Block<R>>]>, R: ArrayLength + NonZero> BufferSet<Q, R>
impl<Q: AsRef<[Align64<Block<R>>]> + AsMut<[Align64<Block<R>>]>, R: ArrayLength + NonZero> BufferSet<Q, R>
Sourcepub fn new(q: Q) -> Self
pub fn new(q: Q) -> Self
Create a new buffer set
§Panics
Panics if the number of blocks is less than 4 or greater than MAX_N + 2.
Sourcepub fn try_new(q: Q) -> Option<Self>
pub fn try_new(q: Q) -> Option<Self>
Create a new buffer set if the number of blocks is between 4 and MAX_N + 2
§Returns
None if the number of blocks is less than 4 or greater than MAX_N + 2
Sourcepub fn into_inner(self) -> Q
pub fn into_inner(self) -> Q
Consume the buffer set and return the inner buffer
Sourcepub fn input_buffer(&self) -> &Align64<Block<R>>
pub fn input_buffer(&self) -> &Align64<Block<R>>
Get the block buffer as 32-bit words
Sourcepub fn input_buffer_mut(&mut self) -> &mut Align64<Block<R>>
pub fn input_buffer_mut(&mut self) -> &mut Align64<Block<R>>
Get the block buffer mutably as 32-bit words
Sourcepub fn set_input(&mut self, hmac_state: &Pbkdf2HmacSha256State, salt: &[u8])
pub fn set_input(&mut self, hmac_state: &Pbkdf2HmacSha256State, salt: &[u8])
Set the input for the block buffer
Sourcepub fn raw_salt_output(&self) -> &Align64<Block<R>>
pub fn raw_salt_output(&self) -> &Align64<Block<R>>
Get the raw salt output, useful for concatenation for P>1 cases
Sourcepub fn extract_output(
&self,
hmac_state: &Pbkdf2HmacSha256State,
output: &mut [u8],
)
pub fn extract_output( &self, hmac_state: &Pbkdf2HmacSha256State, output: &mut [u8], )
Extract the output from the block buffer
Sourcepub fn shorten(
&mut self,
cf: NonZeroU8,
) -> Option<(BufferSet<&mut [Align64<Block<R>>], R>, &mut [Align64<Block<R>>])>
pub fn shorten( &mut self, cf: NonZeroU8, ) -> Option<(BufferSet<&mut [Align64<Block<R>>], R>, &mut [Align64<Block<R>>])>
Shorten the buffer set into a smaller buffer set and return the remainder as a slice, handy if you want to make a large allocation for the largest N you want to use and reuse it for multiple Cost Factors.
§Returns
None if the number of blocks is less than the minimum number of blocks for the given Cost Factor.
Sourcepub fn ro_mix_front(&mut self)
pub fn ro_mix_front(&mut self)
Start an interleaved pipeline using the default engine by performing the $RoMix_{Front}$ operation.
Sourcepub fn ro_mix_back(&mut self)
pub fn ro_mix_back(&mut self)
Drain an interleaved pipeline using the default engine by performing the $RoMix_{Back}$ operation.
Sourcepub fn scrypt_ro_mix(&mut self)
pub fn scrypt_ro_mix(&mut self)
Perform the RoMix operation using the default engine.
Sourcepub fn ro_mix_interleaved(&mut self, other: &mut Self)
pub fn ro_mix_interleaved(&mut self, other: &mut Self)
Perform the RoMix operation with interleaved buffers.
$RoMix_{Back}$ is performed on self and $RoMix_{Front}$ is performed on other.
§Panics
Panics if the buffers are of different equivalent Cost Factors.
Sourcepub fn pipeline<K, S, C: PipelineContext<S, Q, R, K>, I: IntoIterator<Item = C>>(
&mut self,
other: &mut Self,
iter: I,
state: &mut S,
) -> Option<K>
pub fn pipeline<K, S, C: PipelineContext<S, Q, R, K>, I: IntoIterator<Item = C>>( &mut self, other: &mut Self, iter: I, state: &mut S, ) -> Option<K>
Pipeline RoMix operations on an iterator of inputs.