Struct chksum_hash_sha2_384::Update
source · pub struct Update { /* private fields */ }
Expand description
A hash state containing an internal buffer that can handle an unknown amount of input data.
§Example
use chksum_hash_sha2_384 as sha2_384;
// Create a new hash instance
let mut hash = sha2_384::Update::new();
// Fill with data
hash.update("data");
// Finalize and create a digest
let digest = hash.finalize().digest();
assert_eq!(
digest.to_hex_lowercase(),
"2039e0f0b92728499fb88e23ebc3cfd0554b28400b0ed7b753055c88b5865c3c2aa72c6a1a9ae0a755d87900a4a6ff41"
);
// Reset to default values
hash.reset();
// Produce a hash digest using internal finalization
let digest = hash.digest();
assert_eq!(
digest.to_hex_lowercase(),
"38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b"
);
Implementations§
source§impl Update
impl Update
sourcepub fn update(&mut self, data: impl AsRef<[u8]>) -> &mut Self
pub fn update(&mut self, data: impl AsRef<[u8]>) -> &mut Self
Updates the internal state with an input data.
§Performance issues
To achieve maximum performance, the length of incoming data parts should be a multiple of the block length.
In any other case, an internal buffer is used, which can cause a speed decrease in performance.
Trait Implementations§
source§impl<'arbitrary> Arbitrary<'arbitrary> for Update
impl<'arbitrary> Arbitrary<'arbitrary> for Update
source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moresource§impl PartialEq for Update
impl PartialEq for Update
source§impl Update for Update
impl Update for Update
impl Eq for Update
impl StructuralPartialEq for Update
Auto Trait Implementations§
impl Freeze for Update
impl RefUnwindSafe for Update
impl Send for Update
impl Sync for Update
impl Unpin for Update
impl UnwindSafe for Update
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