waddling-errors-hash 0.7.3

Compact xxHash3-based error code hashing for network-efficient diagnostics in distributed systems
Documentation

🦆 waddling-errors-hash

WDP-compliant xxHash3 computation for diagnostic codes.

Crates.io Documentation


What It Does

Converts error codes to compact 5-character hashes per WDP Part 5.

use waddling_errors_hash::compute_wdp_hash;

let hash = compute_wdp_hash("E.Auth.Token.001");
// Returns 5-char base62 hash, e.g., "V6a0B"

// Case-insensitive (WDP normalization):
assert_eq!(
    compute_wdp_hash("E.Auth.Token.001"),
    compute_wdp_hash("e.auth.token.001")
);

Installation

[dependencies]
waddling-errors-hash = "0.7"

API

WDP-Conformant (Recommended)

use waddling_errors_hash::{
    compute_wdp_hash,           // Hash error code
    compute_wdp_namespace_hash, // Hash namespace
    compute_wdp_full_id,        // "ns_hash-code_hash"
};

let code_hash = compute_wdp_hash("E.Auth.Token.001");       // "V6a0B"
let ns_hash = compute_wdp_namespace_hash("auth_lib");       // "05o5h"
let full_id = compute_wdp_full_id("auth_lib", "E.Auth.Token.001"); // "05o5h-V6a0B"

Custom Seed

use waddling_errors_hash::{compute_hash_with_config, HashConfig};

let config = HashConfig::with_seed(0x1234567890ABCDEF);
let hash = compute_hash_with_config("E.Auth.Token.001", &config);

WDP Seeds

Purpose Seed u64 Value
Error codes "wdp-v1" 0x000031762D706477
Namespaces "wdpns-v1" 0x31762D736E706477

Cross-Language

Same algorithm works in Python, JS, Go, etc:

import xxhash
WDP_SEED = 0x000031762D706477
hash_value = xxhash.xxh3_64(input_bytes, seed=WDP_SEED)

Security Note

xxHash3 is NOT cryptographically secure. It's designed for speed and distribution quality. Use TLS/JWT for security requirements.


Documentation


License

MIT or Apache-2.0.