amebazii::util

Function md5

Source
pub fn md5(data: &[u8]) -> Result<[u8; 16], Error>
Expand description

Computes an MD5 hash of the provided data.

This function computes the MD5 hash of the input data. The result is a 128-bit (16-byte) hash.

§Parameters

  • data: A byte slice containing the data to be hashed.

§Returns

  • Ok([u8; 16]): A 16-byte array containing the computed MD5 hash.
  • Err(error::Error): An error if there is a failure during the hashing process.

§Example

use my_crate::md5;
let data = b"message";
let hash = md5(data).unwrap();
assert_eq!(hash.len(), 16); // The MD5 hash should be 16 bytes.

§Errors

This function may return an error if there is a failure during the MD5 hashing process.