Entropy and Security Analysis
Relevant source files
The following files were used as context for generating this wiki page:
The qib13 system is a reproducible multi-deviation seed recovery tool. Its security model is designed to separate a simple, memorable 13-character generatorCode from a high-entropy masterSeed. This allows for the deterministic generation of multiple encoding systems, providing both cryptographic security and reliability through redundancy. The security of the entire system is fundamentally dependent on the secrecy of the master seed.
The system's core function is to transform the generatorCode into a 55-character seed. The security analysis focuses on the sources of entropy, the cryptographic primitives used for deterministic generation, and the threat model associated with the system's architecture.
Sources: README.md:10-15
Security Components and Entropy Sources
The total entropy of the qib13 system is a combination of three distinct components. The security relies on the master seed, while the generator code and deviation systems add layers of complexity.
| Component | Description | Entropy Contribution |
|---|---|---|
| Master Seed | A string of any length that serves as the root of trust. It is the primary source of entropy and is used to deterministically generate all encoding systems. | L × log₂(26) bits, where L is the length of the master seed. |
| Generator Code | A 13-character string (a-z) that is encoded into the final 55-character seed. It is intended to be simple and memorable. | 13 × log₂(26) ≈ 61.1 bits. |
| Deviation Index | The index of the specific encoding system used. The uncertainty of which system was used adds a small amount of entropy. | log₂(N) bits, where N is the number of deviation systems. |
The total system entropy is the sum of these components: (L × log₂(26)) + 61.1 + log₂(N) bits. For a typical 80-character master seed and 10 deviation systems, the total entropy is approximately 440.4 bits.
Sources: README.md:18-21, 62-73
Cryptographic Primitives and Deterministic Generation
The system's reproducibility is ensured by a cryptographically secure deterministic Random Number Generator (RNG) built using HMAC-SHA256. This RNG is used to create the matrices and permutations for each encoding system.
HMAC-based Deterministic RNG
The CryptoSeededRandom class implements a deterministic RNG using HMAC-SHA256 in counter mode. It is seeded with the masterSeed. For each request for random bytes, it computes HMAC-SHA256(key, counter), where the key is derived from the master seed and the counter is incremented. This ensures that the same master seed always produces the same sequence of random numbers.
The implementation includes a check for the browser's Web Crypto API but currently uses a fallback pure JavaScript implementation of SHA-256 and HMAC to maintain synchronous behavior.
This diagram shows the process of generating a random 32-bit integer.
CryptoSeededRandom Class
The CryptoSeededRandom class is the foundation for all deterministic generation in the application.
Sources: index.html:381-439
The system uses this RNG to generate the components of each EncodingSystem. The master seed is combined with a suffix (e.g., -original-1 or -deviation-N) to ensure each system is unique yet deterministically derived.
This sequence diagram illustrates how a master seed is used to create a unique encoding system.
Sources: index.html:681-696, 704-717, README.md:41-45
Security Model and Threat Analysis
The security of qib13 is contingent on the secrecy of the master seed.
Security Model
- With Master Seed Secrecy: The system provides substantial entropy (e.g., ~440 bits for an 80-character seed), making brute-force attacks computationally infeasible. An attacker without the master seed cannot reproduce the encoding systems and therefore cannot decode a seed.
- With Master Seed Compromise: If the master seed is compromised, the security reduces to the entropy of the generator code (~61.1 bits) plus the deviation index (
log₂(N)bits). This combination may be vulnerable to a targeted brute-force attack, where the attacker iterates through all possible generator codes for each deviation system.
The following diagram illustrates the security dependency.
Sources: README.md:75-83, 142-145
Threat Model
| Threat Actor | Access Level | Attack Vector | Vulnerability |
|---|---|---|---|
| External Attacker | No access to master seed. | Observing a generated seed. | Cannot recover the generator code without the master seed. The system is secure. |
| Internal Attacker | Has access to the master seed. | Brute-force generator codes across all deviation systems. | The generator code's limited entropy (61.1 bits) becomes the primary weakness. |
Sources: README.md:85-90
Limitations
- Master Seed Dependency: The entire security model collapses if the master seed is exposed. Secure storage of the master seed is critical.
- Generator Code Entropy: The 13-character generator code has fixed, limited entropy. Predictable codes (e.g.,
aaaaaaaaaaaaa) should be avoided, although theREADME.mdnotes thataaaaaa...is specifically disabled. - Computational Overhead: Sequential recovery across many deviation systems is computationally intensive, which could theoretically be a vector for a denial-of-service attack if the recovery process is exposed as a service.
Sources: README.md:4, 140-151
Conclusion
The qib13 tool's security architecture is a practical trade-off between usability and cryptographic strength. It achieves high security and reproducibility by anchoring its system in a high-entropy, secret masterSeed while allowing users to interact with a low-entropy, memorable generatorCode. The use of a deterministic HMAC-SHA256-based RNG is a sound choice for generating the encoding systems. However, the security is brittle; the compromise of the master seed reduces the system's security to a level that may be vulnerable to brute-force attacks, making the protection of the master seed the most critical aspect of its use.
Sources: README.md:153-159