pub trait StorageHasher: 'static {
    type Output: AsRef<[u8]>;

    const METADATA: StorageHasherIR;

    // Required methods
    fn hash(x: &[u8]) -> Self::Output;
    fn max_len<K: MaxEncodedLen>() -> usize;
}
Expand description

Hasher to use to hash keys to insert to storage.

Required Associated Types§

Required Associated Constants§

Required Methods§

source

fn hash(x: &[u8]) -> Self::Output

source

fn max_len<K: MaxEncodedLen>() -> usize

The max length of the final hash, for the given key type.

Implementors§

source§

impl StorageHasher for Blake2_128

source§

const METADATA: StorageHasherIR = metadata_ir::StorageHasherIR::Blake2_128

§

type Output = [u8; 16]

source§

impl StorageHasher for Blake2_128Concat

source§

const METADATA: StorageHasherIR = metadata_ir::StorageHasherIR::Blake2_128Concat

§

type Output = Vec<u8, Global>

source§

impl StorageHasher for Blake2_256

source§

const METADATA: StorageHasherIR = metadata_ir::StorageHasherIR::Blake2_256

§

type Output = [u8; 32]

source§

impl StorageHasher for Identity

source§

const METADATA: StorageHasherIR = metadata_ir::StorageHasherIR::Identity

§

type Output = Vec<u8, Global>

source§

impl StorageHasher for Twox64Concat

source§

const METADATA: StorageHasherIR = metadata_ir::StorageHasherIR::Twox64Concat

§

type Output = Vec<u8, Global>

source§

impl StorageHasher for Twox128

source§

const METADATA: StorageHasherIR = metadata_ir::StorageHasherIR::Twox128

§

type Output = [u8; 16]

source§

impl StorageHasher for Twox256

source§

const METADATA: StorageHasherIR = metadata_ir::StorageHasherIR::Twox256

§

type Output = [u8; 32]