Introduction
The Gromark cipher is a Gronsfeld variant that throws away the repeating numeric key and replaces it with a running key generated from your initial digits. You supply a short seed like "312". The first few letters shift by those digits, then the stream keeps growing: each new digit is the sum of the two preceding digits mod 10. That lag-2 Fibonacci recurrence mod 10 produces a non-repeating keystream from a tiny seed, which is the whole appeal. This tool runs the Gromark cipher in your browser, shows the generated digit stream as you type, and handles both encryption and decryption with the same seed. Paste your text below to see the running key in action.
What this tool does
- Encrypts plaintext using a running numeric key built from your initial digits via a lag-2 Fibonacci recurrence mod 10.
- Decrypts Gromark ciphertext by regenerating the identical digit stream and subtracting the same shifts.
- Accepts any initial key of digits 0-9 and ignores non-numeric characters automatically.
- Visualizes the first 20 to 40 digits of the generated running key stream so you can inspect the recurrence.
- Passes non-alphabet characters (spaces, punctuation) through unchanged without consuming key digits.
- Processes everything client-side. Your text and key never leave your browser.
How this tool works
The tool reads your initial key string, strips out anything that is not a digit 0-9, and uses the remaining digits as the seed. For a seed of "312" the stream starts 3, 1, 2, then continues 3 (1+2), 5 (2+3), 8 (3+5), 3 (5+8 mod 10), and so on. Each plaintext letter is shifted forward by the corresponding digit mod 26, exactly like a Gronsfeld cipher but with a non-repeating key. Decryption regenerates the same stream and subtracts the same shifts.
Non-alphabet characters pass through untouched and do not advance the key index, so word spacing and punctuation survive intact. The settings panel prints the running key stream live so you can watch the Fibonacci recurrence produce digits. The swap between encode and decode preserves your input text for quick round-trip checks. All computation is local.
How the Gromark cipher works
The Gromark cipher belongs to the family of running-key polyalphabetic ciphers descended from the Vigenere cipher. Where Gronsfeld repeats a short numeric key cyclically, Gromark extends that key indefinitely with a deterministic recurrence. The standard formulation, documented in William Friedman's "Military Cryptanalytics" (AFM 37-40, Part I), generates each new key digit as the sum of the two preceding digits mod 10. This is a lag-2 linear recurrence modulo 10, structurally identical to a Fibonacci sequence reduced to a single decimal digit.
Because the recurrence is linear and operates mod 10, the stream is periodic. The period depends on the seed: for a two-digit seed the cycle length divides 10^2 - 1 = 99 in the worst case, though many seeds hit the maximum period of 60 before repeating (the multiplicative order structure of the recurrence matrix mod 10). That is far longer than a typical Gronsfeld key, which is why Gromark resists simple Kasiski examination better than its parent cipher.
The shift operation itself is plain Vigenere: each letter's position (A=0) is increased by the key digit mod 26. Since the digits range 0-9, only ten of the twenty-six possible shifts ever appear. That constraint leaks information. A cryptanalyst who knows the cipher is Gromark can recover the seed by trying all 100 two-digit combinations and checking which produces readable plaintext, a trivial brute-force attack. The cipher's strength is historical and pedagogical, not practical. It teaches how deterministic keystream generation turns a short key into a long non-repeating one, the same principle behind modern stream ciphers like the autokey cipher and RC4, though those use stronger recurrence functions.
How to use this tool
- Enter your initial key as digits 0-9 in the key field. Two or more digits give the Fibonacci recurrence enough seed material.
- Type or paste your plaintext into the input area when encrypting, or ciphertext when decrypting.
- Select Encode to produce ciphertext, or Decode to recover plaintext.
- Inspect the running key stream shown in the settings panel to verify the recurrence is generating the digits you expect.
- Use the same initial key to decrypt. The stream regenerates identically because the recurrence is deterministic.
- Copy the result when done. Non-letter characters pass through unchanged.
Real-world examples
Encrypting with seed 312
Plaintext: "HELLO". Seed "312" produces the stream 3, 1, 2, 3, 5. H shifts by 3 to K, E shifts by 1 to F, L shifts by 2 to N, L shifts by 3 to O, O shifts by 5 to T. Output: "KFNOT". The fifth digit (5) comes from (2 + 3) mod 10, the first generated digit beyond the seed.
Round-trip verification
Encrypt any message with seed "729", then paste the ciphertext back, switch to Decode, and keep the same seed. The tool regenerates the identical stream 7, 2, 9, 1, 0, 1, 1, 2, 3, 5, 8, 3... and subtracts each shift, recovering the original plaintext exactly. This confirms the recurrence is deterministic and reversible.
CTF challenge with a known Gromark ciphertext
A puzzle provides ciphertext "HVCBCL" and hints that the cipher is Gromark with a two-digit seed. You try seeds 00 through 99 in the Decode mode. Seed "11" produces stream 1, 1, 2, 3, 5, 8 and reveals "GUAYXD", which is not English. Seed "72" produces 7, 2, 9, 1, 0, 1 and reveals "ATTACK", a readable word. The brute force takes seconds because the seed space is only 100 entries.
Comparison with similar methods
| Method | Complexity | Typical use |
|---|---|---|
| Gromark | O(n) with lag-2 Fibonacci keystream mod 10 | Running-key Gronsfeld variant, CTF puzzles |
| Gronsfeld | O(n) with repeating numeric key | 17th century field cipher, repeating digit shifts |
| Vigenere | O(n) with repeating alphabetic key | Polyalphabetic substitution, le chiffre indechiffrable |
| Autokey | O(n) with plaintext-extended key | Non-repeating key from the message itself |
Limitations or considerations
The Gromark cipher is not secure by modern standards. The seed space is tiny: two-digit seeds give only 100 possibilities, so brute force is instant. Even longer seeds fall to known-plaintext attacks because the linear recurrence mod 10 is easy to reverse once a few keystream digits are recovered. The digit range 0-9 also means only ten of twenty-six shifts appear, which constrains the ciphertext alphabet and aids frequency analysis on long messages. The cipher's value is teaching how a short seed drives a long keystream via a recurrence, the conceptual root of stream ciphers. For actual confidentiality, use AES-256 or ChaCha20. This tool passes non-alphabet characters through unchanged, so word structure remains visible in the ciphertext.
Frequently asked questions
How is Gromark different from Gronsfeld?
Gronsfeld repeats a short numeric key cyclically. Gromark uses the initial digits as a seed and extends them with a recurrence: each new digit is the sum of the two preceding digits mod 10. This produces a non-repeating keystream from a short seed, where Gronsfeld's key loops every few characters. See the Gronsfeld cipher tool for the repeating-key version.
What recurrence does Gromark use to generate the key stream?
A lag-2 Fibonacci recurrence mod 10. After the initial seed digits, each new digit equals (previous digit + digit before that) mod 10. For seed 312 the stream continues 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 0, 7, 7, 4, 1, 5, 6, 1, 7, 8, 5, 3, 8, 1, 9, 0, 9, 9, 8, 7, 5, 2, 7, 9, 6, 5, 1, 6, 7.
Is the Gromark cipher secure?
No. A two-digit seed has only 100 possibilities, so brute force takes milliseconds. The linear recurrence mod 10 is also reversible once an attacker recovers a few keystream digits from known plaintext. Gromark is a teaching tool for running-key concepts, not a real encryption scheme. Use AES-GCM via the Web Crypto API for actual security.
Why does the tool need at least two seed digits?
The lag-2 Fibonacci recurrence needs two preceding digits to generate the next one. With a single seed digit the tool falls back to repeating that digit. Two or more digits let the recurrence run as intended and produce the characteristic non-repeating stream.
Conclusion
The Gromark cipher shows how a short numeric seed can drive a long, non-repeating keystream through a simple recurrence. This tool implements the lag-2 Fibonacci mod 10 generator, visualizes the digit stream, and handles both encryption and decryption with the same seed. It is a good stepping stone from the repeating Gronsfeld cipher toward modern stream ciphers. For real encryption, use AES-256. To compare related ciphers on this site, try the Vigenere cipher, the autokey cipher, or the Vernam cipher.