use crate::backend;
use crate::core::Raw;
#[derive(Clone, Copy, Debug)]
pub struct Md5State {
raw: Raw,
}
impl Default for Md5State {
#[inline]
fn default() -> Self {
Self::new()
}
}
impl Md5State {
#[inline]
pub const fn new() -> Self {
Self { raw: Raw::new() }
}
#[inline]
pub fn update(&mut self, input: &[u8]) {
self.raw.update_opt(input);
}
#[inline]
#[must_use]
pub fn finalize(&self) -> [u8; 16] {
self.raw.digest_snapshot(backend::compress_block)
}
#[inline]
pub fn reset(&mut self) {
self.raw.reset();
}
#[inline]
pub const fn bytes_hashed(&self) -> u64 {
self.raw.count
}
#[inline]
pub const fn is_empty(&self) -> bool {
self.raw.count == 0
}
}