-
-
Save jlawhon/b161273f97cbe1793aeb51b437483d34 to your computer and use it in GitHub Desktop.
Solution to puzzle at http://www.recruitahacker.net/Puzzle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment