Hacker News new | past | comments | ask | show | jobs | submit login
Vigenère Cipher (wikipedia.org)
55 points by ferros on July 4, 2019 | hide | past | favorite | 20 comments



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...

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


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

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


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...


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.)


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.


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


'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... [1]: https://hn.algolia.com/?query=The%20effectiveness%20of%20Tur... [2]: https://github.com/cipherboy/vCAT


I'd totally forgotten I wrote that!


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...


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

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


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.


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.


You could say the same as CTR mode


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


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


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


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.


Same here in the Cryptology course at UMD. That whole class was just so much fun.


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

[1] Quritania.com


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: