[−][src]Function extendhash::md5::padding_length_for_input_length
pub fn padding_length_for_input_length(input_length: usize) -> usize
Compute the MD5 padding length (in bytes) for the given input length.
The result is always between 9 and 72 (inclusive).
Arguments
input_length
- The length of the input length. This value is used because the amount of padding is always such that the total padded string is a multiple of 64 bytes.
Returns
This function returns the amount of padding required for the given input length.
Example
let data = "This string will be hashed."; let padding_length = md5::padding_length_for_input_length(data.len()); assert_eq!(data.len() + padding_length, 64);