Function near_sdk::env::sha256_array

source ·
pub fn sha256_array(value: &[u8]) -> [u8; 32]
Expand description

Hashes the bytes using the SHA-256 hash function. This returns a 32 byte hash.

§Examples

use near_sdk::env::sha256_array;
use hex;

assert_eq!(
    &sha256_array(b"The phrase that will be hashed"),
    hex::decode("7fc38bc74a0d0e592d2b8381839adc2649007d5bca11f92eeddef78681b4e3a3")
        .expect("Decoding failed")
        .as_slice()
);