Last active
September 30, 2018 07:35
-
-
Save fat-tire/316855b7a37ef8fd8270270254e922bf 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
@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.