Struct Md5

Source
pub struct Md5 { /* private fields */ }

Implementations§

Source§

impl Md5

Source

pub fn new() -> Self

Source

pub fn consume(&self, data: &[u8]) -> Self

Returns a new Md5 object with the updated state of the md5 calculation It means that this function is pure (no mutations)

§Example
let mut md5 = md5_core::Md5::new();
md5 = md5.consume(b"hello");
Source

pub fn digest(&self) -> u128

§Example
let mut md5 = md5_core::Md5::new();
md5 = md5.consume(b"hello");
md5 = md5.consume(b"world");
assert_eq!(md5.digest(), 0xfc5e038d38a57032085441e7fe7010b0);
Source

pub fn calculate(input: &[u8]) -> u128

Returns the md5 hash of the input byte array

§Limitations

Works only with complete bytes (multiples of 8 bits)

§Example
assert_eq!(
    md5_core::Md5::calculate(b"helloworld"),
    0xfc5e038d38a57032085441e7fe7010b0
);

Auto Trait Implementations§

§

impl Freeze for Md5

§

impl RefUnwindSafe for Md5

§

impl Send for Md5

§

impl Sync for Md5

§

impl Unpin for Md5

§

impl UnwindSafe for Md5

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.