diff --git a/answers.md b/answers.md index 45933f3..1e6fab3 100644 --- a/answers.md +++ b/answers.md @@ -31,5 +31,9 @@ 5. What is the polyalphabetic secret word? +PYTHON (this literally took me so long but it was also so fun omg) + 6. Decrypt this message, which was encrypted using the same secret word: "EbZhdaV[h^bTpchhQnhig]X[VmhhRP]ftXVnRfjVY]fgtO_X](" + +'The treasure is a worthless ball of aluminum foil.' (anticlimatic, lol) \ No newline at end of file diff --git a/caesar_cracker.py b/caesar_cracker.py index 0d5dcda..bdc2f7f 100644 --- a/caesar_cracker.py +++ b/caesar_cracker.py @@ -22,10 +22,27 @@ def crack_caesar(ciphertext): target = char diff = Bits(target,8).int - Bits(" ",8).int + cipher = CaesarCipher(diff) - decryptedtext = cipher.decrypt(fulltext) + decryptedtext = cipher.decrypt(fulltext) #I included this part to double check that the function works return diff, decryptedtext +def polyalpha_helper(text): #used to help crack the code! + groups = [[],[],[],[],[],[]] + for i in range(len(text)): + for n in range(6): + if i%6 == n: + groups[n].append(text[i]) + + groupmax = [] + + for alist in groups: + counter = dict(Counter(alist)) + sorter = sorted(counter.items(), key=lambda item: item[1], reverse = True) + max = sorter[0] + groupmax.append(max) + + print(groupmax)