The Gronsfeld Cipher: wtjqvimttgdbghtrtt

--

There’s a scene in 2001: A Space Odyssey, where HAL (the intelligent computer) listens to Dave talking about him, and where HAL lip-reads:

Basically, we are now moving into the world depicted by 2001, and where AI can almost detect our every thought, and can listen to part of our lives.

And, so, as we are spied upon for virtually every second of our online (and even offline) world, we perhaps will need to find ways to communicate without AI being able to interpret our communications and thoughts. One of the best ways, of course, is to use encryption. Another way is to use good old ciphers, so let’s have a bit of cipher generation using the Gronsfeld cipher.

So, let’s take, “openthepodbaydoors” and a key of “845321”. We thus gave a grid of:

0 abcdefghijklmnopqrstuvwxyz
1 bcdefghijklmnopqrstuvwxyza
2 cdefghijklmnopqrstuvwxyzab
3 defghijklmnopqrstuvwxyzabc
4 efghijklmnopqrstuvwxyzabcd
5 fghijklmnopqrstuvwxyzabcde
6 ghijklmnopqrstuvwxyzabcdef
7 hijklmnopqrstuvwxyzabcdefg
8 ijklmnopqrstuvwxyzabcdefgh
9 jklmnopqrstuvwxyzabcdefghi

Now, the first number if an “8”, and so we may an ‘o’ to a ‘w’:

0 abcdefghijklmn o pqrstuvwxyz
8 ijklmnopqrstuv w xyzabcdefgh

We can then progress through the letters to get:

wtjqvimttgdbghtrtt

We can code this with:

        public static string getGronsfeld(string s,string key)
{
s = s.ToLower();
string rtn = "";
var count = 0;

foreach (char ch in s)
{

try
{


if (ch == ' ') rtn = rtn + " ";
else if (ch >= 'a' && ch <= 'z')
{
var shift = Char.GetNumericValue(key[count % key.Length]);
if (shift >= 0)
{
rtn = rtn + (char)((((int)ch - (int)'a' + shift) % 26) + (int)'a');
count++;
}
}

}
catch (Exception ex) { }

}
return (rtn);

}

and so here is the challenge:

and you can try 136 ciphers by pressing the big red button, and waiting for a little while:

PS: A proper AI agent with frequency analysis will be able to crack the Gronsfeld cipher, so don’t use it for your secret messages. It will need a fairly long length of ciphertext, though, as it needs to find repeated patterns. The length of the key is obviously important, too.

--

--

Prof Bill Buchanan OBE FRSE
ASecuritySite: When Bob Met Alice

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.