Crate waddling_errors_hash

Crate waddling_errors_hash 

Source
Expand description

WDP-compliant hash computation for waddling-errors diagnostic codes

This crate provides WDP-specified hash computation for error codes. Per WDP Part 5: Compact IDs, all error codes use xxHash3 with seed 0x000031762D706477.

§Features

  • WDP Compliant: Uses xxHash3 with the standard WDP seed
  • Deterministic: Same input always produces same hash
  • Compact: 5-character base62 encoding (916M combinations)
  • Fast: xxHash3 is optimized for small inputs (~30 GB/s)
  • Cross-language: xxHash3 available in C, Python, JS, Go, Java, Rust
  • no_std compatible: Works in constrained environments

§Quick Start

use waddling_errors_hash::{compute_hash, compute_wdp_hash};

// Standard hash (no normalization)
let hash = compute_hash("E.AUTH.TOKEN.001");

// WDP-compliant hash (with case normalization)
let wdp_hash = compute_wdp_hash("e.auth.token.001");

§WDP Specification

Per WDP Part 5:

  • Algorithm: xxHash3
  • Seed: 0x000031762D706477 (ASCII “wdp-v1\0\0” as little-endian u64)
  • Output: 5 characters (base62)
  • Input normalization: uppercase for consistency

Re-exports§

pub use algorithm::HashAlgorithm;
pub use algorithm::HashConfig;
pub use algorithm::ParseHashAlgorithmError;
pub use algorithm::WDP_SEED;
pub use algorithm::WDP_SEED_STR;
pub use base62::to_base62;
pub use base62::u64_to_base62;
pub use config_loader::DocGenConfig;
pub use config_loader::apply_overrides;
pub use config_loader::load_doc_gen_config;
pub use config_loader::load_global_config;
pub use config_loader::load_namespace;
pub use wdp::WDP_CODE_SEED;
pub use wdp::WDP_NAMESPACE_SEED;
pub use wdp::compute_wdp_full_id;
pub use wdp::compute_wdp_hash;
pub use wdp::compute_wdp_namespace_hash;
pub use wdp::normalize_wdp_input;
pub use wdp::parse_wdp_full_id;
pub use wdp::verify_wdp_hash;
pub use wdp::verify_wdp_namespace_hash;
pub use wdp::const_format_sequence;
pub use wdp::const_hash_to_base62;
pub use wdp::const_wdp_hash;
pub use wdp::const_wdp_hash_bytes;
pub use wdp::const_wdp_hash_from_parts;

Modules§

algorithm
WDP-compliant hash algorithm
base62
Base62 encoding for hash output
config_loader
Configuration loader for reading global settings from Cargo.toml
wdp
WDP (Waddling Diagnostic Protocol) Conformant Hash Implementation
xxhash_impl
xxHash3 implementation for WDP-compliant hashing

Functions§

compute_hash
Compute a 5-character base62 hash from an input string
compute_hash_with_config
Compute hash with custom configuration
verify_hash
Verify that a hash was computed from the given input
verify_hash_with_config
Verify that a hash was computed from the given input using custom config