redaction

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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

func ComputeContentHash(s string) string

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

func RedactString(s string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL