referrerpolicy=no-referrer-when-downgrade
frame_support

Trait StorageHasher

Source
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 Constants§

Required Associated Types§

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.

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.

Implementors§

Source§

impl StorageHasher for Blake2_128

Source§

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

Source§

type Output = [u8; 16]

Source§

impl StorageHasher for Blake2_128Concat

Source§

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

Source§

type Output = Vec<u8>

Source§

impl StorageHasher for Blake2_256

Source§

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

Source§

type Output = [u8; 32]

Source§

impl StorageHasher for Identity

Source§

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

Source§

type Output = Vec<u8>

Source§

impl StorageHasher for Twox64Concat

Source§

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

Source§

type Output = Vec<u8>

Source§

impl StorageHasher for Twox128

Source§

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

Source§

type Output = [u8; 16]

Source§

impl StorageHasher for Twox256

Source§

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

Source§

type Output = [u8; 32]