Skip to content

Instantly share code, notes, and snippets.

@fat-tire
Last active September 30, 2018 07:35
Show Gist options
  • Save fat-tire/316855b7a37ef8fd8270270254e922bf to your computer and use it in GitHub Desktop.
Save fat-tire/316855b7a37ef8fd8270270254e922bf to your computer and use it in GitHub Desktop.
Solution to puzzle at http://www.recruitahacker.net/Puzzle
#!/usr/bin/python3
# Vigenere Cipher solver thing
# by fattire / github.com/fat-tire
# for puzzle at http://www.recruitahacker.net/Puzzle
# For more, see: https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher
import string
key = "aaaaaaaaaaaaaaaaaa" # Gotta start somewhere
newkey = ""
encrypted = "Kozgtyuycwtzfvg, z"
target = "Congratulations, i" # I figured this was the first word.
for i, c in enumerate(key):
if encrypted[i] not in string.ascii_letters:
continue
diff = ord(encrypted[i]) - ord(target[i])
if (diff < 0):
diff = diff + len(string.ascii_lowercase) #26
newkey += chr(ord(c) + diff)
print(newkey)
@DredNaut
Copy link

@Ladysman213,
They changed the cipher, so this solution no longer works with the new cipher. You could probably rework the code a little bit to crack the new one though.

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