llm-hasher: Local PII Detection and Tokenization for Hybrid LLM Workflows

llm-hasher addresses a specific security gap in hybrid LLM workflows: when you run local LLMs but still call external services like OpenAI, Claude, or Gemini for certain tasks, your PII still leaves your infrastructure in plaintext. This tool runs PII detection entirely locally using Ollama, so no data leaves your systems during the detection phase.
How It Works
The process follows three steps: detect PII locally, tokenize it before external LLM calls, then restore the original values after processing. This prevents sensitive data from being exposed to third-party services.
Detection Approach
The detection system uses a hybrid approach:
- Regex patterns for structured data types: credit cards, IBAN numbers, email addresses, and IPv4 addresses
- Ollama with llama3.2:3b (by default) for contextual detection of unstructured PII: names, addresses, national IDs, passports, and dates of birth
Technical Implementation
Mappings between original PII and tokens are stored in an AES-256-GCM encrypted SQLite vault. Deployment is simplified with Docker Compose, which spins up both Ollama and the llm-hasher service with a single command.
📖 Read the full source: r/LocalLLaMA
👀 See Also

BlindKey: Blind Credential Injection for AI Agents
BlindKey is a security tool that prevents AI agents from accessing plaintext API credentials by using encrypted vault tokens and a local proxy. Agents reference tokens like bk://stripe, and the proxy injects the real credential at request time.

OpenClaw Skill Analyzer: Static Security Scanner for AI Agent Skills
A developer built a static analyzer that scans OpenClaw skills for security risks before installation, with 40+ detection rules across 12 categories including prompt injection and data exfiltration.

AI Security Researchers: Your 0-Day Vulnerabilities May Leak via Data Opt-In Toggle
The 'Improve the model for everyone' toggle in LLM interfaces can automatically harvest deep red-teaming research, sending your vulnerability concepts to vendor safety teams and potentially to academic papers before you publish. Disable data sharing before conducting serious security research.

Secure and Protect OpenClaw in Just 2 Minutes with Nono Kernel-Based Isolation
OpenClaw users can now enjoy enhanced security without compromising performance, thanks to Nono kernel-based isolation, a quick and effective solution that takes just two minutes.