Skip to main content

Module hash

Module hash 

Source
Expand description

This module contains a selection of cryptographic hash functions implementing a common HashFunction trait.

§Example

let digest1 = Sha256::digest(b"Hello, world!");

let mut hash_function = Sha256::default();
hash_function.update(b"Hello, ");
hash_function.update(b"world!");
let digest2 = hash_function.finalize();

assert_eq!(digest1, digest2);

Structs§

Digest
Represents a digest of DIGEST_LEN bytes.
EllipticCurveMultisetHash
EllipticCurveMultisetHash (ECMH) is a homomorphic multiset hash function. Concretely, each element is mapped to a point on an elliptic curve on which the DL problem is hard (the Ristretto group in Curve25519), and the hash is the sum of all such points.
HashFunctionWrapper
This wraps a digest::Digest as a HashFunction.

Traits§

Hash
This trait is implemented by all messages that can be hashed.
HashFunction
Trait implemented by hash functions providing a output of fixed length
MultisetHash
A Multiset Hash is a homomorphic hash function, which hashes arbitrary multisets of objects such that the hash of the union of two multisets is easy to compute from the hashes of the two multisets.
ReverseWrapper
This trait allows using a HashFunctionWrapper where a digest::Digest was expected.

Type Aliases§

Blake2b256
The BLAKE2-256 hash function with 256 bit digests.
Keccak256
The KECCAK hash function with 256 bit digests.
Sha3_256
The SHA-3 hash function with 256 bit digests.
Sha3_512
The SHA-3 hash function with 512 bit digests.
Sha256
The SHA-2 hash function with 256 bit digests.
Sha512
The SHA-512 hash function with 512 bit digests.