Skip to content

Instantly share code, notes, and snippets.

@shipstar
Last active October 4, 2015 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shipstar/45c32c40ac2ea24174ee to your computer and use it in GitHub Desktop.
Save shipstar/45c32c40ac2ea24174ee to your computer and use it in GitHub Desktop.
Vigenere Cipher Example -- Landsliders puzzle

You'll need to use the Vigenère table to calculate the encrypted text.

I'll walk through the encryption first; decryption just involves working backwards.

WARNING: There are spoilers below about the outcome of the Landsliders puzzle.

  1. Write the phrase you want to encrypt:
WWWWHATHAPPENEDINLANDSLIDERSCOM
  1. Above it, write your keyword, repeating it as many times as needed to match the length of the text to encrypt:
PRETTYGREATPRETTYGREATPRETTYGRE
WWWWHATHAPPENEDINLANDSLIDERSCOM
  1. Using the Vigenère table linked above, find the row that matches the letter to encrypt in your keyword. Let's start with 'P'. Now, looking at the 'P' row, find the column that matches the letter to encrypt -- in this case, 'W'. If you look at where the 'P' row and 'W' column intersect, you should see 'L'. That's the first letter.
PRETTYGREATPRETTYGREATPRETTYGRE
WWWWHATHAPPENEDINLANDSLIDERSCOM
L
  1. Continue matching letter by letter using the table, and you'll end up with:
PRETTYGREATPRETTYGREATPRETTYGRE
WWWWHATHAPPENEDINLANDSLIDERSCOM
LNAPAYZYEPITEIWBLRRRDLAZHXKQIFQ

And sure enough, that's the encrypted URL from Landsliders. :)

To decrypt, just run the process in reverse. Find the 'P' row, then figure out which column corresponds to 'L'. (You'd find that it's 'W'.) Continue to find the full URL.

If you're a programmer, there's a Ruby library you can use to encrypt / decrypt. This online tool will also work, and can be used to make guesses about likely keys based on letter frequency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment