Skip to main content

sha2_256

Function sha2_256 

Source
pub fn sha2_256(data: &[u8]) -> [u8; 32]
Expand description

Computes the SHA2-256 hash of the input.

This is used for Secp256k1 ECDSA message hashing.

ยงExample

use aptos_sdk::crypto::sha2_256;

let hash = sha2_256(b"hello world");
assert_eq!(hash.len(), 32);