tokmd-redact
Redaction utilities for privacy-safe tokmd output.
Overview
This is a Tier 0.5 utility crate providing BLAKE3-based hashing functions for redacting sensitive information in receipts while preserving useful structure.
Installation
[]
= "1.3"
Usage
use ;
// Hash any string to 16 characters
let hash = short_hash;
assert_eq!;
// Redact path while preserving extension
let redacted = redact_path;
assert!;
// Result: "a1b2c3d4e5f6g7h8.json"
Functions
short_hash(s: &str) -> String
Returns a 16-character BLAKE3 hex hash of the input string.
redact_path(path: &str) -> String
Returns a hashed path with the file extension preserved.
Cross-Platform Consistency
Both functions normalize path separators (\ to /) before hashing, ensuring identical hashes across Windows and Unix:
assert_eq!;
assert_eq!;
Use Cases
- Share receipts without exposing internal paths
- Privacy-safe LLM context generation
- Anonymize repository structure in reports
Redaction Modes (in tokmd-format)
| Mode | Behavior |
|---|---|
None |
Paths shown as-is |
Paths |
Hash file paths, preserve extension |
All |
Hash paths and excluded patterns |
License
MIT OR Apache-2.0