Expand description
Hash computation for waddling-errors diagnostic codes
This crate provides hash computation utilities that can be used both at compile time (in proc macros) and at runtime. The hash function is designed to be:
- Deterministic: Same input always produces same hash
- Compact: 5-character base62 encoding (916M combinations)
- Fast: Uses ahash for performance
- Safe: Alphanumeric only, safe for all logging systems
- no_std compatible: Works in constrained environments
§Usage in Proc Macros (Compile Time)
ⓘ
use waddling_errors_hash::compute_hash;
let hash = compute_hash("E.AUTH.TOKEN.001");
// Embed hash as a compile-time constant§Usage at Runtime
ⓘ
use waddling_errors_hash::compute_hash;
fn main() {
let code = "E.AUTH.TOKEN.001";
let hash = compute_hash(code);
println!("Hash: {}", hash); // e.g., "aB3xY"
}Functions§
- compute_
hash - Compute a 5-character base62 hash from an input string
- verify_
hash - Verify that a hash was computed from the given input