Crate wasmium_hash_id
source · [−]Expand description
The main data structure for the hash ID
Structure
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct WasmiumHashID {
tai_timestamp: [u8; 12],
blake3hash: [u8; 32],
}
Usage
use wasmium_hash_id::WasmiumHashID;
// The message in bytes
let message_id = [0u8; 8];
// Hash the message to get the `blake3::Hash`
let blake3_hash = blake3::hash(&message_id);
// Generate the hash
let hash_id = WasmiumHashID::new(blake3_hash).build();
// Get the original TAI64N timestamp
WasmiumHashID::get_timestamp(hash_id);
// Get the orignal Blake3 Hash
WasmiumHashID::get_blake3_hash(hash_id);
Structs
Structure