Tool to encode and decode text using the Gromark cipher, a substitution cipher that uses a numeric key and a sequence of digits to transform message letters.
Gromark Cipher - dCode
Tag(s) : Poly-Alphabetic Cipher
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
The Gromark cipher is a polyalphabetic substitution cipher system, derived from the Gronsfeld cipher. It uses a keyword to build a mixed alphabet and a number, called a primer, to generate a long numeric key, called the running key.
To encrypt a message with Gromark, follow these steps:
— Build the mixed cipher alphabet by transposition from a keyword (see section below).
Example: The keyword ALPHABET generates the mixed alphabet ACMVBIRZEJSHGQYLDNWPFOXTKU
— Choose a sequence of digits (called a primer) and generate a running key as long as the plaintext using the Fibonacci sequence principle (see section below).
Example: The digit sequence 54321 generates the sequence 5432197530628..
— For each plaintext letter, determine its position $ P $ in the standard alphabet, with $ A=0, B=1, \dots Z=25 $
— Add the corresponding digit of the running key $ K $ to this position, modulo 26: $ Q = (P+K) \mod 26 $
— Replace the letter at position $ Q $ in the standard alphabet with the letter at the same position in the mixed alphabet (index 0).
Example:
| Plaintext letter | G | R | O | M | A | R | K |
| Position P= | 6 | 17 | 14 | 12 | 0 | 17 | 10 |
| Running key K= | 5 | 4 | 3 | 2 | 1 | 9 | 7 |
| Sum %26 Q= | 11 | 21 | 17 | 14 | 1 | 0 | 17 |
| Cipher letter | H | O | N | Y | C | A | N |
Decryption requires knowing the keyword used to build the mixed alphabet and the numeric key (primer).
— Regenerate the running key from the primer (see below).
Example: The digit sequence 54321 generates the sequence 5432197530628..
— For each cipher letter, find its position $ Q $ in the mixed cipher alphabet.
— Subtract the corresponding digit of the running key, modulo 26, to recover the plaintext letter position: $ P = (Q-K) \mod 26 $
— Convert this position to a letter of the standard alphabet, with $ A=0, B=1, \dots Z=25 $
Example:
| Cipher letter | H | O | N | Y | C | A | N |
| Position Q= | 11 | 21 | 17 | 14 | 1 | 0 | 17 |
| Running key K= | 5 | 4 | 3 | 2 | 1 | 9 | 7 |
| Subtraction %26 P= | 6 | 17 | 14 | 12 | 0 | 17 | 10 |
| Plaintext letter | G | R | O | M | A | R | K |
The mixed alphabet used in Gromark is of type K2M:
— Choose a keyword and remove repeated letters, keeping their first occurrence
Example: ALPHABET becomes ALPHBET
— Complete this keyword with the letters of the alphabet not present in it, in alphabetical order, to obtain a sequence of 26 letters.
Example: ALPHBET becomes ALPHBETCDFGIJKMNOQRSUVWXYZ
— Write this sequence in a table with as many columns as there are letters in the deduplicated keyword
Example:
| A | L | P | H | B | E | T |
| C | D | F | G | I | J | K |
| M | N | O | Q | R | S | U |
| V | W | X | Y | Z |
— Assign to each column the alphabetical rank of the corresponding letter of the keyword
Example:
| 1 | 5 | 6 | 4 | 2 | 3 | 7 |
|---|---|---|---|---|---|---|
| A | L | P | H | B | E | T |
| C | D | F | G | I | J | K |
| M | N | O | Q | R | S | U |
| V | W | X | Y | Z |
— Read the columns in increasing order of these ranks to form the mixed cipher alphabet
Example: ACMVBIRZEJSHGQYLDNWPFOXTKU
The running key is built by successively adding the first two digits (as in the Fibonacci sequence) and keeping only the units digit of the result, which is equivalent to calculating modulo 10. This new digit is added to the end of the primer, and the calculation continues with the next 2 digits.
If the first five digits are $ K_1, K_2, K_3, K_4, K_5 $, the recurrence is: $ K_{n+5}=(K_n+K_{n+1})\bmod 10 $
Example: The numeric key 54321 continues with 97530 because $ 5+4=9 $, $ 4+3=7 $, $ 3+2=5 $, $ 2+1=3 $, $ 1+9=10 \equiv 0 \mod 10 $
Continue until having as many digits as the message has letters.
The name Gromark stands for 'GRONsfeld with Mixed Alphabet and Running Key'. The system was published in 1969 in the journal The Cryptogram of the American Cryptogram Association (ACA), by an author using the pseudonym DUMBO.
Several clues may suggest that a message was encrypted with Gromark:
— The presence of a 5-digit number, potentially corresponding to the primer.
— Sometimes a single isolated digit at the end of the message, which can serve as a check digit (the value of the running key for the last letter, allowing verification of the calculations).
— The system is sometimes referred to as Gromark K2.
Yes. The generation of the running key is deterministic and depends on the two previous digits. Each digit belongs to the set $ [0,1,\dots,9] $
There are therefore only $ 10 \times 10 = 100 $ possible states. The key thus eventually becomes periodic for a long message.
The length of the period depends on the initial primer.
dCode retains ownership of the "Gromark Cipher" source code. Any algorithm for the "Gromark Cipher" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Gromark Cipher" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Gromark Cipher" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Gromark Cipher" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Gromark Cipher on dCode.fr [online website], retrieved on 2026-11-19,