Day 14?
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Santa has caught up with the information age and does not trust
|
||||
clear-text commands anymore.
|
||||
clear-text commands anymore.
|
||||
He has decided that all communications
|
||||
have to be encrypted to prevent an unfriendly take-over of his team.
|
||||
Santa chooses a simple, secure, and toolless encryption scheme.
|
||||
@@ -7,24 +7,8 @@ However, his team's memory capacity is limited and so he can only use
|
||||
their names (Dasher, Dancer, Prancer, Vixen, Comet, Cupid, Donder and
|
||||
Blitzen) as keys.
|
||||
|
||||
Dasher
|
||||
Dancer
|
||||
Prancer
|
||||
Vixen
|
||||
Comet
|
||||
Cupid
|
||||
Donder
|
||||
Blitzen
|
||||
|
||||
|
||||
Where is the team headed to?
|
||||
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
|
||||
|
||||
|
||||
STTYN YATLOEP DNEA ONBL TGNTO MHEHH EISTIARIB FHSRA LD IIONA NL HERUV LN17-PTAA-RTON-RDOE-MCTN-AHCO
|
||||
|
||||
-4 +8 +0 +1
|
||||
6 I A B
|
||||
W I A B
|
||||
5 H 9 A
|
||||
-0100 +1000 +0000 +0001
|
||||
|
||||
@@ -1 +1,84 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from itertools import chain, product, permutations
|
||||
|
||||
# Santa has caught up with the information age and does not trust
|
||||
# clear-text commands anymore.
|
||||
# He has decided that all communications
|
||||
# have to be encrypted to prevent an unfriendly take-over of his team.
|
||||
# Santa chooses a simple, secure, and toolless encryption scheme.
|
||||
# However, his team's memory capacity is limited and so he can only use
|
||||
# their names (Dasher, Dancer, Prancer, Vixen, Comet, Cupid, Donder and
|
||||
# Blitzen) as keys.
|
||||
|
||||
|
||||
encrypted = "STTYN YATLOEP DNEA ONBL TGNTO MHEHH EISTIARIB FHSRA LD IIONA NL HERUV LN17-PTAA-RTON-RDOE-MCTN-AHCO"
|
||||
encrypted_words = encrypted.split(" ")
|
||||
|
||||
def load_words():
|
||||
with open('words_alpha.txt') as word_file:
|
||||
valid_words = set(word_file.read().split())
|
||||
|
||||
return valid_words
|
||||
|
||||
english_words = load_words()
|
||||
|
||||
# totalCount = 0
|
||||
# letter_count = {}
|
||||
# for word in encrypted_words[:-1]:
|
||||
# totalCount += len(word)
|
||||
# for letter in word:
|
||||
# if not letter in letter_count:
|
||||
# letter_count[letter] = 1
|
||||
# else:
|
||||
# letter_count[letter] += 1
|
||||
|
||||
# print(letter_count, totalCount)
|
||||
|
||||
# def bruteforce(charset, minlength, maxlength):
|
||||
# return (''.join(candidate)
|
||||
# for candidate in chain.from_iterable(product(charset, repeat=i)
|
||||
# for i in range(minlength, maxlength + 1)))
|
||||
#
|
||||
# def generateKey(cipher, plain):
|
||||
# key = ""
|
||||
# for i in range(min(len(cipher), len(plain))):
|
||||
# key += chr(ord('A') + ord(cipher[i]) - ord(plain[i]))
|
||||
# return key
|
||||
#
|
||||
def decrypt(cipher, key):
|
||||
while len(key) < len(cipher):
|
||||
key += key
|
||||
|
||||
return ''.join([chr(ord('A') + (ord(cipher[i]) + ord(key[i]) - 2 * ord('A')) % 26) for i in range(len(cipher))])
|
||||
|
||||
|
||||
possible_keys = ["DASHER","DANCER","PRANCER","VIXEN","COMET","CUPID","DONDER","BLITZEN"]
|
||||
|
||||
|
||||
# startingLetters = [key[0] for key in possible_keys]
|
||||
# processedKeys = []
|
||||
#
|
||||
# for p in permutations(startingLetters, len(startingLetters)):
|
||||
# key = ''.join(p)
|
||||
# if key not in processedKeys:
|
||||
# processedKeys.append(key)
|
||||
# plain = decrypt(encrypted_words[0], key)
|
||||
# if plain.lower() in english_words:
|
||||
# print(key, plain)
|
||||
|
||||
for key in possible_keys:
|
||||
print(key, decrypt(encrypted_words[0], key[::-1]))
|
||||
#
|
||||
# for key in bruteforce("ABCDEFGHIJKLMNOPQRSTUVXYZ", 5, 5):
|
||||
# plain = decrypt(encrypted_words[0], key)
|
||||
# if key.lower() in english_words and plain.lower() in english_words:
|
||||
# print(key, plain)
|
||||
|
||||
# for word in english_words:
|
||||
# if len(word) == 5:
|
||||
# word = word.upper()
|
||||
# key = generateKey(encrypted_words[0], word).lower()
|
||||
# # if key.isalpha():
|
||||
# if key in english_words:
|
||||
# print(word, key)
|
||||
|
||||
370099
Teaser/_ZOoxjUSe1OVB7OPoVrsX.pdf.extracted/words_alpha.txt
Normal file
370099
Teaser/_ZOoxjUSe1OVB7OPoVrsX.pdf.extracted/words_alpha.txt
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Teaser/footer.png
Normal file
BIN
Teaser/footer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 496 KiB |
Reference in New Issue
Block a user