Skip to main content

Module hash

Module hash 

Source
Expand description

A 32-byte cryptographic hash used throughout the CSV protocol.

This type wraps a fixed-size [u8; 32] array and provides safe conversion between byte slices, hex strings, and the internal representation. All hashing in CSV uses SHA-256 with domain separation to prevent cross-protocol replay attacks (see crate::tagged_hash).

§Examples

use csv_adapter_core::Hash;

// Create from bytes
let h = Hash::new([0xAB; 32]);

// Convert to hex
let hex = h.to_hex();
assert!(hex.starts_with("abab"));

// Parse from hex
let parsed = Hash::from_hex(&hex).unwrap();
assert_eq!(h, parsed);

Structs§

Hash
A 32-byte hash value.

Enums§

HashParseError
Errors that can occur when parsing a Hash from a string or byte slice.