pub trait HostFunctionsProvider {
// Required methods
fn sha2_256(message: &[u8]) -> [u8; 32];
fn sha2_512(message: &[u8]) -> [u8; 64];
fn sha2_512_truncated(message: &[u8]) -> [u8; 32];
fn sha3_512(message: &[u8]) -> [u8; 64];
fn ripemd160(message: &[u8]) -> [u8; 20];
fn blake3hash(message: &[u8]) -> [u8; 32];
}
Expand description
If this is to be executed in a blockchain context, then we need to delegate these hashing functions to a native implementation through host function calls. This trait provides that interface.
Required Methods§
Sourcefn sha2_512_truncated(message: &[u8]) -> [u8; 32]
fn sha2_512_truncated(message: &[u8]) -> [u8; 32]
The SHA-512 hash algorithm with its output truncated to 256 bits.
Sourcefn blake3hash(message: &[u8]) -> [u8; 32]
fn blake3hash(message: &[u8]) -> [u8; 32]
blake3 hash function.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.