
Vigenère Cipher - ferros
https://en.wikipedia.org/wiki/Vigenere_cipher
======
todd8
The Vigenère is the classic example of an historically important cipher. This
cipher is a substitution cipher: each letter of the plaintext is replaced by a
different letter in the ciphertext.

In _simple substitution_ a fixed mapping from the plaintext alphabet to the
ciphertext alphabet is used for the entire message. This can easily be
attacked by study of the frequency distribution of a message's intercepted
ciphertext.

Simple substitution:

    
    
      plaintext:  A B C D E F G H I J K L M ...
      ciphertext: K R P E X J A T O U M S T ...
    
      message:    HIDE A FIG ...
      cipher:     TOEX K JOA ...
    

The Vigenère is an example of a _polyalphabetic substitution_ . In
polyalphabetic substitution ciphers, multiple mappings from plaintext to
ciphertext are used throughout the encipherment of the message, thwarting
simple frequency analysis. The Vigenère uses a particularly simple plan, a key
selects which substitution mapping to use for each letter.

Vigenère:

    
    
      plaintext:  A B C D E F G H I J K L M ...
      cipher a:   A B C D E F G H I J K L M ...
      cipher b:   B C D E F G H I J K L M N ...
      cipher c:   C D E F G H I J K L M N O ...
      ...
      cipher x:   X Y Z A B C D E F G H I J ...
      cipher y:   Y Z A B C D E F G H I J K ...
      cipher z:   Z A B C D E F G H I J K L ...
    
      message:  HIDE A FIG ...
      key:      xyzz y xyz ...
      cipher:   EGCD Y CGF ...
    

Here the key, "xyzzy", is short enough that any reasonable message will be
broken easily with a paper and pencil attack. On the other hand, a key that is
only used once and which is as long as the message makes the Vigenère
equivalent to the unbreakable one-time pad ciphers.

Many variations of the Vigenère make the cryptographer's work much more
difficult. A scrambled tableaux (rather than the simple _Caesar_ ciphers) or a
key controlled by the message itself (called _autoencipherment_ ) present
interesting but not difficult challenges.

When I was around 12 years old (1963) I was fascinated by codes and ciphers
and my aunt gave me a book by Gains, titled Elementary Cryptanalysis[1]. I
can't recommend it highly enough for those interested in the pre-computer
treatment of ciphers. The book was best treatment of cryptography available to
the public when it was originally published in 1939 and it covered the
cryptanalysis of several important ciphers that had seen diplomatic and
military use before World War II.

For example, Gains covers the important Playfair, Double Columnar
Transposition, and Fractional Substitution, and Nihilist ciphers. A famous
Soviet pencil and paper cipher that was never broken (the VIC cipher[2]) used
a combination of the these last three.

[1] Gaines, Helen Fouche, Elementary Cryptanalysis, 1939. Republished by Dover
under a slightly different title. This newer edition contains hint or
solutions to the over 100 samples found in the original.
[https://www.amazon.com/Cryptanalysis-Study-Ciphers-Their-
Sol...](https://www.amazon.com/Cryptanalysis-Study-Ciphers-Their-
Solution/dp/0486200973/ref=sr_1_1?crid=3U12WQ6OJ0TX6&keywords=cryptanalysis&qid=1562244824&s=gateway&sprefix=krypton%2Caps%2C158&sr=8-1)

[2]
[https://en.wikipedia.org/wiki/VIC_cipher](https://en.wikipedia.org/wiki/VIC_cipher)

------
billpg
I once tried to fix one of the flaws of Vigenère and I came up with a slight
modification but still keeping most of the simplicity.

[https://blog.hackensplat.com/2011/02/vinegar.html](https://blog.hackensplat.com/2011/02/vinegar.html)

I then noticed that my new crypto-system itself has a flaw. Oh well.

~~~
Sahhaese
My 'gut' intuition is that doing that is the same as applying the cipher of
length 2, then the cipher of length 3, 5, 7 each in turn invidually, but I
haven't had the chance to dig out cyberchef to confirm this.

Edit: Indeed: (no spoilers for the fun of actually breaking your message)

[https://gchq.github.io/CyberChef/#recipe=Vigen%C3%A8re_Encod...](https://gchq.github.io/CyberChef/#recipe=Vigen%C3%A8re_Encode\('WI'\)Vigen%C3%A8re_Encode\('LHE'\)Vigen%C3%A8re_Encode\('LMVON'\)Vigen%C3%A8re_Encode\('HACKENS'\)&input=QUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEKQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEKQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUEgQUFBQUE)

~~~
billpg
Yes, my cipher is exactly the same as four rounds of Vigenère with 2,3,5,7
length keys, with the proviso that you can't go beyond 210 when all four keys
meet again.

(I may go back and edit the text to make this clear.)

------
client4
LostboY always included a Vigenere cipher in his mystery challenge at DEFCON.
It’s worth searching for team write ups of his challenges; they were some of
the best and most difficult.

------
timvisee
Had some fun with this a while back, with a simple dictionary attack in Rust.
Some might enjoy: [https://github.com/timvisee/vigenere-cipher-
simple](https://github.com/timvisee/vigenere-cipher-simple)

~~~
cipherboy
'jgrahamc posted a Perl implementation of Alan Turing's method which made HN a
couple of times [0], [1]. This is much better than brute force. For something
a little more accessible on mobile, I made this [2] at the time based on his
Perl implementation.

[0]: [https://blog.jgc.org/2015/05/the-effectiveness-of-turings-
vi...](https://blog.jgc.org/2015/05/the-effectiveness-of-turings-
vigenere.html) [1]:
[https://hn.algolia.com/?query=The%20effectiveness%20of%20Tur...](https://hn.algolia.com/?query=The%20effectiveness%20of%20Turing%27s%20Vigen%C3%A8re%20cipher%20breaking%20technique&sort=byDate&dateRange=all&type=story&storyText=false&prefix&page=0)
[2]: [https://github.com/cipherboy/vCAT](https://github.com/cipherboy/vCAT)

~~~
jgrahamc
I'd totally forgotten I wrote that!

------
FredrikMeyer
I recently read Simon Singhs book "The Code Book: The Science of Secrecy from
Ancient Egypt to Quantum Cryptography" [1]: it is very fun and readable about
this (and many other) cipher.

[https://www.amazon.com/Code-Book-Science-Secrecy-
Cryptograph...](https://www.amazon.com/Code-Book-Science-Secrecy-Cryptography-
ebook/dp/B004IK8PLE/ref=sr_1_1?keywords=simon+singh&qid=1562308890&s=gateway&sr=8-1)

------
void_nill
The Kryptos puzzle [1] also contains two Vigenère ciphers.

[1]
[https://en.m.wikipedia.org/wiki/Kryptos](https://en.m.wikipedia.org/wiki/Kryptos)

------
mruts
I’ve always thought the vigenere cipher was incredibly elegant and beautiful.
Also, the Enigma cipher is effectively just a vigenere cipher with a super
long key.

~~~
olliej
No it really isn’t, it is logically a short key with a KDF.

The important thing about a “vignere cipher with a super long key” is that
once the key length matches the length of the message (which is your
implication) vignere ciphers are _provably_ unbreakable. They are the
canonical one time pad.

------
ashton314
My favorite thing about this article is in the “External Links” [1]: Vigenère
Cipher cracker with the source code in the shape of Charles Babbage’s head.
(Written in Perl of course.)

[1]:
[https://www.perlmonks.org/?node_id=550450](https://www.perlmonks.org/?node_id=550450)

------
armytricks
I actually created a cracking tool for this cipher that uses local search
algorithms to analyse and break it without a known key. It also supports
several other classical ciphers.

[https://dulhanjayalath.com/decryptr](https://dulhanjayalath.com/decryptr)

------
maxmunzel
the first practice of our security lecture was breaking vigenere - one of the
coolest practices of my studies so far…

~~~
psynapse
Also did this in cryptography + coding theory class back in university days.

Our final exam had a practical code breaking test where we had a bunch of
utilities and had to crack 3 different cyphers. I've always recounted it
fondly.

------
unipaul
There's a Vigenere cipher on the back of this "book"[1] I wasn't able to
crack.

[1] Quritania.com

------
ptah
lovely childhood memories of playing with this on paper before computers
flooding back

