[][src]Function extendhash::sha512::compute_hash

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

Compute the SHA-512 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-512 hash.

Example

let secret_data = "input string".as_bytes();
let hash = sha512::compute_hash(secret_data);
assert_eq!(&hash[..], &[
    0x61, 0xfd, 0xf5, 0x27, 0xeb, 0x4a, 0x1a, 0x79,
    0x36, 0x33, 0xea, 0x74, 0x5c, 0x36, 0xae, 0x06,
    0xf1, 0x97, 0xb5, 0x65, 0xf0, 0x7e, 0xa0, 0xe2,
    0x25, 0x4c, 0x15, 0x06, 0x4b, 0xd8, 0xc7, 0x44,
    0xd8, 0xe6, 0x6b, 0x73, 0xc5, 0x5b, 0x40, 0x9b,
    0x3d, 0xbc, 0xb3, 0xc3, 0xcf, 0x4f, 0x52, 0xd3,
    0xf2, 0x34, 0xe3, 0xdf, 0xd7, 0xcd, 0x4a, 0x34,
    0x4b, 0xb8, 0xd8, 0x3b, 0xbf, 0x00, 0x94, 0xdb][..]);