Module fog_crypto::hash

source ·
Expand description

Cryptographic hashing.

This module lets you create a cryptographic hash from a byte stream. Cryptographic hashes can be used to uniquely identify a data sequence. They can be passed to an IdentityKey to be signed.

Example

// Create a new hash from raw bytes
let hash = Hash::new(b"I am the entire data sequence");
println!("Hash(Base58): {}", hash);

// Create a hash by feeding in bytes repeatedly
let mut hash_state = HashState::new();
hash_state.update(b"I am the first part of a data sequence");
hash_state.update(b"And I am their sibling, the second part of a data sequence");
let hash = hash_state.finalize();
println!("Hash(Base58): {}", hash);

Structs

  • Crytographically secure hash of data.
  • A hasher that can incrementally take in data and produce a hash at any time.

Constants