Gronsfeld Cipher Encrypt & Decrypt





Gronsfeld Cipher :


Gronsfeld cipher, of Bronckhorst cipher, were made by José de Bronckhorst (earl of Gronsfeld, that's why the cipher has two names) around 1744. As a Belgian diplomate, it was important for him to insure a solid confidentiality during information exchanges.
The cipher in itself is actually a simple Caesar shift in which the shift is defined by a numeric key. One could say that this cipher is a variant of the Vigenere cipher except that in Gronsfeld cipher the key is a sequence of numbers.

To encrypt using Gronsfeld cipher, just take the letters of plain text one by one, and apply a shift corresponding to the number in the key. For instance, say the text to encrypt is "gronsfeld" and the key 1234, you start by shifting the G of 1 position in the alphabet, becoming H, then the R shifts of 2 positions and becomes T, etc. As below :

Plain text : gronsfeld
Key : 123412341
Ciphered text : htrrthhpe

The key here is repeated to match the plaintext length. It is now obvious this cipher doesn't offer any protection. However it is more solid that Caesar shift, as it allows the use of a key, which if long enough will make the bruteforce harder. The key would so have to be long enough, a simple key of 4 letters such as previously seen only offers 9999 possibilities which is very easy to break. Letters frequency analysis allows - just as for Vigenere cipher - to break Gronsfeld cipher. For that you'll have to get a long enough encrypted text, and then find out repetitions in that text. Those repetitions may be the result of the same letters being encrypted by the same part of the key. For instance the word "is" encrypted by the numbers "12". The frequency analysis also allows you to guess the key length. If you have a long enough text, you can after finding all these repetitions, concatenate them and analyse the result to guess the letters.