Expand description
Multihash implementation.
§Feature Flags
Multihash has lots of feature flags, by default a table with cryptographically secure hashers is created.
Some of the features are about specific hash functions, these are (“default” marks the hashers that are enabled by default):
blake2b
: (default) Enable Blake2b hashersblake2s
: (default) Enable Blake2s hashersidentity
: Enable the Identity hashers (using it is discouraged as it’s not a hash function in the sense that it produces a fixed sized output independent of the input size)sha1
: Enable SHA-1 hashersha2
: (default) Enable SHA-2 hasherssha3
: (default) Enable SHA-3 hashersstrobe
: Enable Strobe hashers
In order to enable all cryptographically secure hashers, you can set the
secure-hashes
feature flag (enabled by default).
The library has support for no_std
, if you disable the std
feature flag.
The multihash-impl
feature flag (enabled by default) enables a default
Multihash implementation that contains some of the bundled hashers. If you
want a different set of hash algorithms you can change this with enabled the
corresponding features.
For example if you only need SHA2 hasher, you could set the features in the
multihash
dependency like this:
multihash = { version = …, default-features = false, features = ["std", "multihash-impl", "sha2"] }
If you want to customize your code table even more, for example you want
only one specific hash digest size and not whole family, you would only
enable the derive
feature (enabled by default), which enables the
Multihash
derive, together with the hashers you want.
The arb
feature flag enables the quickcheck arbitrary implementation for
property based testing.
For serializing the multihash there is support for Serde via the
serde-codec
feature and the SCALE Codec via the scale-codec
feature.
Re-exports§
pub use sp_multihash_derive as derive;
Structs§
- Blake2b
Digest - Multihash digest.
- Blake2b
Hasher - Multihash hasher.
- Blake2s
Digest - Multihash digest.
- Blake2s
Hasher - Multihash hasher.
- Blake3
Digest - Multihash digest.
- Blake3
Hasher - Multihash hasher.
- Identity
Digest - Multihash digest.
- Identity
Hasher - Identity hasher with a maximum size.
- Keccak224
- Multihash hasher.
- Keccak256
- Multihash hasher.
- Keccak384
- Multihash hasher.
- Keccak512
- Multihash hasher.
- Keccak
Digest - Multihash digest.
- Multihash
Generic - A Multihash instance that only supports the basic functionality and no hashing.
- Sha2
Digest - Multihash digest.
- Sha2_
256 - Multihash hasher.
- Sha2_
512 - Multihash hasher.
- Sha3
Digest - Multihash digest.
- Sha3_
224 - Multihash hasher.
- Sha3_
256 - Multihash hasher.
- Sha3_
384 - Multihash hasher.
- Sha3_
512 - Multihash hasher.
- Unknown
Digest - Multihash digest.
Enums§
Traits§
- Digest
- Size marker trait. Stack allocated digest trait.
- Hasher
- Trait implemented by a hash function implementation.
- Multihash
Digest - Trait that implements hashing.
- Stateful
Hasher - Trait implemented by a hash function implementation.
Type Aliases§
- Blake2b256
- 256 bit blake2b hasher.
- Blake2b512
- 512 bit blake2b hasher.
- Blake2s128
- 256 bit blake2b hasher.
- Blake2s256
- 512 bit blake2b hasher.
- Blake3_
256 - blake3-256 hasher.
- Identity256
- 32 byte Identity hasher (constrained to 32 bytes).
- Multihash
- A Multihash with the same allocated size as the Multihashes produces by this derive.
- Result
- Multihash result.