Documentation
¶
Overview ¶
Package redaction provides utilities for redacting sensitive information from requests and responses for safe debug logging.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeContentHash ¶
ComputeContentHash computes a cryptographic hash for content uniqueness tracking. This hash is used for debugging purposes and unique content detection, particularly for: - Tracking cache hits/misses by correlating identical content across requests - Identifying duplicate or similar requests without exposing actual content - Debugging issues by matching redacted logs to specific content patterns - Unique detection of content for deduplication and analysis
We use SHA256 for: - Strong collision resistance for reliable unique detection - Cryptographic properties suitable for content identification - Standard hash function widely used for content addressing
Returns a 16-character hex string (first 64 bits of SHA256 hash) for compact representation while maintaining strong collision resistance.
func RedactString ¶
RedactString replaces sensitive string content with a placeholder containing length and hash. The hash allows correlating logs with specific content for debugging without exposing the actual sensitive data.
Format: [REDACTED LENGTH=n HASH=xxxxxxxx]
Example: "secret API key 12345" becomes "[REDACTED LENGTH=19 HASH=a3f5e8c2]"
Types ¶
This section is empty.