Expand description
A more efficient, no_std SHA-256 for the Solana SVM.
On target_os = "solana", hashing routes through the sol_sha256
syscall. Off-Solana, it falls through to the sha2 crate so the same
APIs work in host code (tests, off-chain tooling). The Solana
implementation costs ~100 CUs for hashv(&[b"test"]), vs ~120 CUs for
solana_program::hash::hashv.
Constants§
- HASH_
LENGTH - Length of a SHA-256 digest, in bytes.
Functions§
- hash
- Hash a single byte slice and return the digest by value.
- hash_
into - Hash
datadirectly into the provided 32-byte buffer. - hash_
ref - Hash any
T: AsRef<[u8]>(e.g.&str,&[u8; N]) and return the digest. - hashv
- Hash a sequence of byte slices as if they were concatenated, and return the digest. Cheaper than concatenating the inputs yourself.