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 keccak_256(message: &[u8]) -> [u8; 32];
    fn ripemd160(message: &[u8]) -> [u8; 20];
    fn blake2b_512(message: &[u8]) -> [u8; 64];
    fn blake2s_256(message: &[u8]) -> [u8; 32];
    fn blake3(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§

source

fn sha2_256(message: &[u8]) -> [u8; 32]

The SHA-256 hash algorithm

source

fn sha2_512(message: &[u8]) -> [u8; 64]

The SHA-512 hash algorithm

source

fn sha2_512_truncated(message: &[u8]) -> [u8; 32]

The SHA-512 hash algorithm with its output truncated to 256 bits.

source

fn keccak_256(message: &[u8]) -> [u8; 32]

The Keccak-256 hash function.

source

fn ripemd160(message: &[u8]) -> [u8; 20]

The Ripemd160 hash function.

source

fn blake2b_512(message: &[u8]) -> [u8; 64]

BLAKE2b-512 hash function.

source

fn blake2s_256(message: &[u8]) -> [u8; 32]

BLAKE2s-256 hash function.

source

fn blake3(message: &[u8]) -> [u8; 32]

BLAKE3 hash function.

Object Safety§

This trait is not object safe.

Implementors§