Skip to main content

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.

Tests Python PyPI License

๐Ÿ‡บ๐Ÿ‡ธ 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

  • CPF: Mod 11 algorithm
  • CNPJ: Weighted Mod 11
  • Credit Cards: Luhn algorithm
  • Pix: Format validation

๐Ÿฆ Vault Mode

  • AES-256 encryption
  • Reversible for debugging
  • CLI decryption tool
  • Master key protection

๐Ÿฏ Honeytokens

  • Intrusion detection
  • Bait data alerts
  • Real-time monitoring
  • Security integration

โšก Circuit Breaker

  • Flood protection
  • Auto-recovery
  • Resource optimization
  • Server stability

๐Ÿš€ 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


Built with precision by Samuel Silva

Protecting data with mathematics, not magic โœจ

GitHub Stars GitHub Forks

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

opaque_logger-0.1.1.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opaque_logger-0.1.1-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

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

Hashes for opaque_logger-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c5c473d23f20faaef6dadeb5e6b9cad070a7d70b790d8c7a68f99443a896b833
MD5 f58c26f25eaf849f5cd1b6463a900f4f
BLAKE2b-256 f5c40c541c28cdb04437d950892f5850a857a52e11136509ef4fd527a6ef247d

See more details on using hashes here.

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

Hashes for opaque_logger-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11f1ad2cacc8b48da54c01e012687797b986f575d048ca052cedacf9e1f882bf
MD5 b2aabe8cbc6753eb42a40e1e84fc37b5
BLAKE2b-256 d6b8fe2c932f9387ff608762a7fc2e0f65127fbf03ab5c4c5c596c9e5fc60a9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page