Welcome to qib13
Relevant source files
The following files were used as context for generating this wiki page. The repository contains a single-page web application; therefore, only two primary source files are relevant for analysis. To meet the structural requirements of the prompt, these files are cited extensively.qib13 is a reproducible multi-deviation seed recovery system designed to transform a short, memorable 13-character "generator code" into a 55-character seed. The core principle is to generate multiple deterministic encoding systems from a single "master seed". This allows for reliable encoding and decoding, where the original generator code can be recovered from the 55-character seed by testing it against the generated systems. The system is implemented as a single-page web application and is recommended to be run offline for maximum security.
The architecture separates the security, which relies on a complex master seed, from usability, which is provided by a simple generator code. This offers a practical balance for seed management, enhancing reliability through its multi-deviation approach while remaining user-friendly.
Sources: README.md:7-13, index.html:1-2
System Architecture
The qib13 system is built upon four core components that work together to create, encode, and recover seeds deterministically.
Sources: README.md:17-24
This diagram shows the flow from the Master Seed, which initializes the random number generator to create multiple Encoding Systems. A Generator Code is then processed by one of these systems to produce a Seed, which can later be decoded back to the original Generator Code.
Sources: README.md:17-24, index.html:565-598
Key Components
| Component | Description | Source |
|---|---|---|
| Master Seed | A user-provided string of any length that acts as the root for deterministically generating all encoding systems. A default is provided, but custom seeds are recommended. | README.md:28-30 |
| Generator Code | A 13-character lowercase string (a-z) that is the input for the encoding process. It is designed to be simple and memorable. | README.md:34-36 |
| Encoding Systems | A set of deterministic systems generated from the Master Seed. There is one 'Original' system and N 'Deviation' systems. Each has unique matrices and permutations. | README.md:40-48 |
| Seed | A 55-character lowercase string (a-z) produced by encoding the generator code. It contains the original code plus parity information for validation. | README.md:50-52 |
User Interface
The application is organized into four main tabs, each serving a distinct function in the qib13 workflow.
Sources: index.html:79-100
| Tab | Function |
|---|---|
| Generate Systems | Creates the set of 'Original' and 'Deviation' encoding systems from a Master Seed and a specified number of systems. |
| Generate Seed | Encodes a 13-letter generator code into a 55-letter seed using a selected encoding system. |
| Recover Code | Recovers the 13-letter generator code from a 55-letter seed by trying one or all available encoding systems. |
| Batch Test | Runs a series of automated tests to verify that randomly generated codes can be successfully encoded and recovered. |
Core Implementation
The core logic is self-contained within the index.html file, revolving around two main classes: CryptoSeededRandom for number generation and EncodingSystem for the encoding/decoding logic.
Cryptographically Secure RNG
The system's determinism is rooted in a custom seeded random number generator, CryptoSeededRandom. It uses an HMAC-SHA256 algorithm in counter mode to produce a deterministic sequence of random numbers from an initial seed string. This ensures that the same master seed always generates the exact same set of encoding systems. A pure JavaScript implementation of SHA-256 is included as a fallback for environments where the Web Crypto API is unavailable.
Sources: index.html:191-201, README.md:104-105
// index.html:423-430
class CryptoSeededRandom {
constructor(seedStr) {
this.seedStr = seedStr || "";
this.counter = 0;
this.buffer = new Uint8Array(32); // SHA-256 produces 32 bytes
this.bufferIndex = 32; // Start with empty buffer
this.initialized = false;
this.useWebCrypto = false;
// Initialize synchronously for compatibility
this._initializeSync();
}
EncodingSystem Class
This class encapsulates all the logic for a single encoding system, including its unique matrices and permutations. It provides methods to generate a seed from a generator code and to recover a code from a seed.
Sources: index.html:508-516
This diagram illustrates the structure of the EncodingSystem class, which is central to the application's functionality.
Functional Flows
System Generation
Systems are generated based on the master seed. The 'Original' system is derived from the master seed with a specific suffix, while 'Deviation' systems are derived from the master seed with different suffixes, ensuring each system is unique yet deterministic.
createOriginalSystem(id, seed): Generates a 42x13 matrix (P) and a 55-element permutation.createDeviationSystem(id, seed): Generates two matrices, a 15x13 (P1) and a 27x13 (P2), and a 55-element permutation.
The matrices and permutations are created using generateRandomMatrix and generateRandomPermutation, which draw numbers from the CryptoSeededRandom instance.
Sources: index.html:818-831, index.html:833-845
Encoding: Generator Code to Seed
The encoding process transforms the 13-character generator code into a 55-character seed. The process differs slightly between 'Original' and 'Deviation' systems.
This flowchart shows the steps to encode a generator code into a seed for both system types.
Sources: index.html:533-550, index.html:552-570
Decoding: Seed to Generator Code
Decoding is the reverse process. It validates the seed against a system's parameters and extracts the original 13-character code.
This flowchart outlines the recovery process, which includes a critical parity check to validate the seed's integrity against a specific encoding system.
Sources: index.html:572-593, index.html:595-622
Security Analysis
The security of qib13 is contingent on the secrecy of the master seed. The system's total entropy is a combination of the master seed's entropy, the generator code's entropy (approx. 61.1 bits), and the entropy from the number of deviation systems.
- With Master Seed Secrecy: The system is computationally infeasible to brute-force due to the high entropy of a sufficiently long master seed.
- With Master Seed Compromise: Security degrades to the entropy of the generator code and the deviation index. In this scenario, a 13-character generator code could be vulnerable to brute-force attacks.
The multi-deviation model adds a layer of security by introducing uncertainty; an attacker without the master seed knows neither the system parameters nor which of the N systems was used for encoding.
Sources: README.md:54-73
Conclusion
qib13 offers a novel and robust method for managing cryptographic seeds by combining a high-entropy master seed with a low-entropy, memorable generator code. Its deterministic, multi-system architecture provides high reliability for data recovery. The entire implementation is transparent and auditable within a single HTML file, which can be run offline to mitigate online threats. The system is a practical tool for applications requiring a balance between strong security and user-friendly operation.
Sources: README.md:150-157