[−][src]Function extendhash::sha256::compute_hash
pub fn compute_hash(input: &[u8]) -> [u8; 32]
Compute the SHA-256 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-256 hash.
Example
let secret_data = "input string".as_bytes(); let hash = sha256::compute_hash(secret_data); assert_eq!(hash, [ 0xf2, 0x3f, 0x47, 0x81, 0xd6, 0x81, 0x4e, 0xbe, 0x34, 0x9c, 0x6b, 0x23, 0x0c, 0x1f, 0x70, 0x07, 0x14, 0xf4, 0xf7, 0x0f, 0x73, 0x50, 0x22, 0xbd, 0x4b, 0x1f, 0xb6, 0x94, 0x21, 0x85, 0x99, 0x93]);