fastpy_rs.crypto
def
sha256(data):
Calculate SHA-256 hash of the input bytes.
Arguments
data- Input bytes to be hashed
Returns
- Hex-encoded SHA-256 hash string
Example
use fastpy_rs::crypto::sha256;
let result = sha256(&[104, 101, 108, 108, 111]); // "hello" in bytes
assert_eq!(result, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824");
def
sha256_str(data):
Calculate SHA-256 hash of the input string.
Arguments
data- Input string to be hashed
Returns
- Hex-encoded SHA-256 hash string
Example
assert_eq!(sha256_str("hello"), "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824");