[][src]Function extendhash::sha1::compute_hash

pub fn compute_hash(input: &[u8]) -> [u8; 20]

Compute the SHA-1 hash of the input data

Arguments

  • input - The input data to be hashed - this could be a UTF-8 string or any other binary data.

Returns

This function returns the computed SHA-1 hash.

Example

let secret_data = "input string".as_bytes();
let hash = sha1::compute_hash(secret_data);
assert_eq!(hash, [
    0xb1, 0xa3, 0x9a, 0x26, 0xea, 0x62, 0xa5, 0xc0, 0x75, 0xcd,
    0x3c, 0xb5, 0xaa, 0x46, 0x49, 0x2c, 0x8e, 0x11, 0x34, 0xb7]);