pub struct BatchHasher<B: RawEncodingBuf> { /* private fields */ }bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
Expand description
A hasher that can process several inputs at the same time in batches.
This hasher works by interleaving the trits of the inputs in each batch and hashing this interleaved representation. It is also able to fall back to the regular CurlP algorithm if required.
Implementations§
Source§impl<B> BatchHasher<B>
impl<B> BatchHasher<B>
Sourcepub fn new(input_length: usize, rounds: CurlPRounds) -> Self
👎Deprecated: bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
pub fn new(input_length: usize, rounds: CurlPRounds) -> Self
bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
Create a new hasher.
It requires the length of the input, the length of the output hash and the number of rounds.
Sourcepub fn add(&mut self, input: TritBuf<B>)
👎Deprecated: bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
pub fn add(&mut self, input: TritBuf<B>)
bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
Add a new input to the batch.
It panics if the size of the batch exceeds BATCH_SIZE or if input.len() is not equal to
the input_length parameter of the constructor.
Sourcepub fn len(&self) -> usize
👎Deprecated: bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
pub fn len(&self) -> usize
bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
Return the length of the current batch.
Sourcepub fn is_empty(&self) -> bool
👎Deprecated: bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
pub fn is_empty(&self) -> bool
bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
Check if the current batch is empty.
Sourcepub fn hash_batched(&mut self) -> impl Iterator<Item = TritBuf> + '_
👎Deprecated: bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
pub fn hash_batched(&mut self) -> impl Iterator<Item = TritBuf> + '_
bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
Hash the received inputs using the batched version of CurlP.
This function also takes care of cleaning the buffers of the struct and resetting the batched CurlP hasher so it can be called at any time.
Sourcepub fn hash_unbatched(&mut self) -> impl Iterator<Item = TritBuf> + '_
👎Deprecated: bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
pub fn hash_unbatched(&mut self) -> impl Iterator<Item = TritBuf> + '_
bee-crypto will not be supported in future versions. You can use functions from iota-crypto instead.
Hash the received inputs using the regular version of CurlP.
In particular this function does not use the bct_inputs and bct_hashes buffers, takes
care of cleaning the trit_inputs buffer and resets the regular CurlP hasher so it can be
called at any time.