Deterministic Data Masking Engine with Mathematical Validation - No AI Guessing
Project description
๐ก๏ธ OPAQUE
Deterministic Data Masking Engine
Don't guess if it's a CPF. Prove it mathematically.
๐บ๐ธ English | ๐ง๐ท Portuguรชs | ๐ช๐ธ Espaรฑol
The only data masking library that uses MATH, not AI
๐ฏ Why OPAQUE?
Unlike AI-based solutions that guess, OPAQUE validates using mathematical algorithms:
| Feature | AI Solutions | OPAQUE |
|---|---|---|
| Validation | Neural networks (guessing) | Mathematical algorithms (proof) |
| False Positives | Common | Zero |
| Performance | Slow (GPU required) | Ultra-fast (pure math) |
| Debuggability | Black box | Deterministic hashing |
| Reversibility | No | Yes (Vault Mode) |
โจ Key Features
๐ Mathematical Validation
|
๐ฆ Vault Mode
|
๐ฏ Honeytokens
|
โก Circuit Breaker
|
๐ Quick Start
Installation
pip install opaque-logger
Basic Usage
import logging
from opaque import OpaqueLogger, Validators
# Configure
OpaqueLogger.setup_defaults(
rules=[Validators.BR.CPF, Validators.BR.CNPJ],
obfuscation_method="HASH"
)
# Integrate
logging.setLoggerClass(OpaqueLogger)
logger = logging.getLogger("app")
# Log securely
logger.info("User CPF: 529.982.247-25")
# Output: User CPF: [HASH-3A4C]
๐ Performance Benchmarks
Sanitization: 1,000+ messages/sec
CPF Validation: 65,000+ ops/sec
CNPJ Validation: 68,000+ ops/sec
Credit Card: 122,000+ ops/sec
Vault Encryption: 22,000+ ops/sec
๐งช Test Coverage
pytest -v
Results: โ 24/24 tests passing (100% success rate)
๐ Examples
๐น Vault Mode (Reversible Encryption)
OpaqueLogger.setup_defaults(
obfuscation_method="VAULT",
vault_key="your-master-key"
)
logger.info("Processing CPF 529.982.247-25")
# Output: Processing CPF [VAULT:gAAAAABl...]
# Decrypt later
python -m opaque.cli reveal "[VAULT:gAAAAABl...]" --key=your-master-key
# Output: ๐ REVEALED DATA: 529.982.247-25
๐น Honeytokens (Intrusion Detection)
OpaqueLogger.setup_defaults(
honeytokens=["999.888.777-66"] # Bait CPF
)
logger.info("Access with CPF 999.888.777-66")
# Stderr: ๐จ ALERTA VERMELHO: HONEYTOKEN DETECTED
# Output: Access with CPF [HONEYTOKEN TRIGGERED]
๐น Crash Handler (Traceback Sanitization)
from opaque import install_crash_handler
install_crash_handler()
# Now all crashes sanitize sensitive data
password = "secret123"
cpf = "529.982.247-25"
raise ValueError(f"Error: {cpf}")
# Traceback shows: ValueError: Error: [HASH-3A4C]
# Locals show: password = [REDACTED_SECRET_KEY]
๐น Compliance Scanning
python -m opaque.cli scan ./src --output=report.html
# Output: ๐ก๏ธ Security Score: 98%
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ OPAQUE Engine โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 1. Regex Pattern Matching (Context-Aware) โ
โ 2. Mathematical Validation (Mod 11, Luhn) โ
โ 3. Honeytoken Detection โ
โ 4. Circuit Breaker Check โ
โ 5. Obfuscation (Hash/Vault/Mask) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Supported Validators
๐ง๐ท Brazil
- โ CPF - Individual taxpayer ID
- โ CNPJ - Company taxpayer ID
- โ Pix - Instant payment keys
๐ณ Finance
- โ Credit Cards - Visa, Mastercard, Amex, etc.
๐ Coming Soon
- CNH (Driver's License)
- Renavam (Vehicle Registration)
- Mercosul License Plates
๐ Documentation
| Language | Link |
|---|---|
| ๐บ๐ธ English | Complete Guide |
| ๐ง๐ท Portuguรชs | Guia Completo |
| ๐ช๐ธ Espaรฑol | Guรญa Completa |
๐ค Contributing
We welcome contributions! See our Contributing Guide.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Links
- PyPI Package: opaque-logger
- Issues: GitHub Issues
- Changelog: CHANGELOG.md
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opaque_logger-0.1.1.tar.gz.
File metadata
- Download URL: opaque_logger-0.1.1.tar.gz
- Upload date:
- Size: 32.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5c473d23f20faaef6dadeb5e6b9cad070a7d70b790d8c7a68f99443a896b833
|
|
| MD5 |
f58c26f25eaf849f5cd1b6463a900f4f
|
|
| BLAKE2b-256 |
f5c40c541c28cdb04437d950892f5850a857a52e11136509ef4fd527a6ef247d
|
File details
Details for the file opaque_logger-0.1.1-py3-none-any.whl.
File metadata
- Download URL: opaque_logger-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11f1ad2cacc8b48da54c01e012687797b986f575d048ca052cedacf9e1f882bf
|
|
| MD5 |
b2aabe8cbc6753eb42a40e1e84fc37b5
|
|
| BLAKE2b-256 |
d6b8fe2c932f9387ff608762a7fc2e0f65127fbf03ab5c4c5c596c9e5fc60a9f
|