The Gnosis cipher combines a simple substitution cipher
with diffusion over a block. In fact, the cipher performs
two stages: the first for substitution; the second for
diffusion (good ciphers mix them together much more). The
first stage simply substitutes each alphabetical character
with a different character according to a keyed table.
The substitution table can be represented by
a string of 26 letters, with no repetitions; implicit in the
table is a top row of ordered letters, for example:
Plain text letter: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Substitution key: BNHULVDZIXKYFMCJEWQOSARPGT
The substitution stage simply replaces each letter in the
plain text with a different one in the keyed table. The
diffusion stage operates on the intermediate
substitution text in 10-character blocks. Each indexed
position in a substitution text block moves to a different
position in the cipher text block. Basically, we just use
the same kind of table as with the substitution stage. For
example:
Starting Index: 0123456789
Diffused Index: 5136097482
In each substitution text block, just look at an index
position and record the character found there in the
corresponding position indicated by the keyed diffusion
table. Of course, an encryption will usually involve
performing diffusion on multiple sequential blocks.
Reversing the algorithm is simple; just use the tables in
the opposite order. A key for the algorithm consists of 26
letters followed by 10 digits, with no value repetitions of
either (more compact representations of the key are easily
possible). Every key will encode the same plain text to a
different cipher text, which is our goal.
The Gnosis cipher is not a particularly good algorithm, as they
go (although it is not terrible for a pencil-and-paper one).
But the nice thing about it is that it
implements the most important elements found in strong algorithms.