pub struct Md5 { /* private fields */ }Expand description
✨ 🔐 🔀 Incremental Md5 state.
📦 size_of::<Md5>() == 92 bytes / 736 bits #️⃣ #[cfg(target_pointer_width = “32”)]
⚗️Option<T> ❗🟰 T
📦 size_of::<Md5>() == 96 bytes / 768 bits #️⃣ #[cfg(target_pointer_width = “64”)]
⚗️Option<T> ❗🟰 T
This implementation is allocation-free, compile-time friendly, and supports incremental updates.
Use update to feed bytes and finalize
to consume the state and return the digest.
Generated with digest!.
Implementations§
Source§impl Md5
impl Md5
Sourcepub const DIGEST_LEN: usize = 16
pub const DIGEST_LEN: usize = 16
The digest size in bytes.
Sourcepub const fn update(&mut self, bytes: &[u8]) -> Result<(), CryptoError> ⓘ
pub const fn update(&mut self, bytes: &[u8]) -> Result<(), CryptoError> ⓘ
Updates the digest state with bytes.
§Errors
Returns LengthOverflow
if the total message length would exceed MD5’s 64-bit bit-length field.
Sourcepub const fn digest_bytes(
bytes: &[u8],
) -> Result<Digest<{ Md5::DIGEST_LEN }>, CryptoError> ⓘ
pub const fn digest_bytes( bytes: &[u8], ) -> Result<Digest<{ Md5::DIGEST_LEN }>, CryptoError> ⓘ
Computes the MD5 digest of bytes.
§Errors
Returns LengthOverflow
if bytes exceeds MD5’s supported message length.
Sourcepub const fn hmac(
key: &[u8],
message: &[u8],
) -> Result<Digest<{ Md5::DIGEST_LEN }>, CryptoError> ⓘ
pub const fn hmac( key: &[u8], message: &[u8], ) -> Result<Digest<{ Md5::DIGEST_LEN }>, CryptoError> ⓘ
Computes the HMAC of message using the given key.
If the key is longer than the block size, it is first hashed.
§Errors
Returns LengthOverflow if key hashing or the
inner/outer digest computation exceeds the hash input length limit.
Trait Implementations§
impl Copy for Md5
impl Eq for Md5
impl StructuralPartialEq for Md5
Auto Trait Implementations§
impl Freeze for Md5
impl RefUnwindSafe for Md5
impl Send for Md5
impl Sync for Md5
impl Unpin for Md5
impl UnsafeUnpin for Md5
impl UnwindSafe for Md5
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.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
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice only.