General.Codes // TrigHash
SECURE OFFLINE PWA

Visual Hash Generator

Initializing...

Verification Proof

Simulate a scanner decoding the matrix using the key above.

Engine Export

Download the standalone engine.

Protocol Documentation

The Mechanism Explained

TrigHash differs from standard QR generation by interjecting a nonlinear mutation layer before the matrix generation.

  • Exponential/Quadratic Variances: Inside the nonlinear_distort function, we apply a formula approximating (alpha * i2 + beta). Variables alpha and beta are derived from your "strings of mutational formulas" (the entropy seed). This creates a time-variant (index-variant) distortion. The first byte is distorted differently than the second, creating a "rolling code" effect.
  • Multiplexing:
    • Public View: If you scan this with a normal phone camera, it will decode to random garbage characters. The error correction logic works, but it preserves the encrypted noise.
    • Private View: With the correct Seed/Key, the receiver reverses the nonlinear function on the decoded bytes to reveal the true "DATA".
  • Space Efficiency: This solution adds zero extra pixels to the QR code. The "obfuscation" lives entirely inside the mathematical relationship between the bits, effectively "multiplexing" the security layer on top of the data layer without consuming spatial bandwidth.

Mathematical Proof of Security

The protocol operates on a principle of Symmetric Stream Mutation with Cipher Block Chaining (CBC).

1. Proof of Reversibility
Encryption: Ci = Pi ⊕ M(i, K, Ci-1)
Decryption: Pi = Ci ⊕ M(i, K, Ci-1)

Where P is Plaintext, C is Ciphertext, and M is the Mutation Function. Because XOR (⊕) is its own inverse, and the receiver possesses the Key (K) and the previous byte (Ci-1), they can perfectly recalculate the mask M.

2. Proof of Obfuscation

We use a Binary Quadratic Trigonometric function for the mask M:

M = |sin(K·i) · (i2 + eCi-1)| mod 255
  • Nonlinearity: The i2 (quadratic) and ex (exponential) terms ensure that linear cryptanalysis fails. You cannot predict the output of index 10 based simply on index 1.
  • Avalanche Effect: Due to the dependency on Ci-1 (the previous encrypted byte), a change in a single bit of the input key propagates through the entire remaining stream.

Comparative Analysis

Feature Traditional QR Hash TrigHash Protocol
Data Payload Plaintext (Readable by anyone) Ciphertext (Looks like garbage without Key)
Dependencies Requires OpenSSL / Huge JS libs Zero Dependencies (Pure Math)
Visual Output Static (Always looks the same) Dynamic (Changes based on Key)
Security Model Database Lookup (Online) Mathematical Entanglement (Offline)
Efficiency High CPU overhead (RSA/AES) Instant (Browser Math functions)

Why This Matters

  • Data Sovereignty (Offline Verification): In a "Data Economy," connectivity is a vulnerability. This script allows two parties to verify authentic data without a central server. If I hand you a printed QR code, and you scan it with the agreed Key, you know it came from me.
  • Steganographic Capacity: To the naked eye (and standard scanners), this is a valid QR code. It doesn't look broken. A standard scanner reads it as random text. This provides plausible deniability.

Raw TrigHash Engine (Reusable)

Copy the code below to use the engine in any other project.

`; const blob = new Blob([htmlContent], {type: "text/html"}); const link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = "trighash_engine.html"; link.click(); } // Initial Run runGen(); // Inputs listener ['in-data', 'in-key'].forEach(id => document.getElementById(id).addEventListener('input', runGen));