diff --git a/answers.md b/answers.md index 2009447..f95a895 100644 --- a/answers.md +++ b/answers.md @@ -36,8 +36,12 @@ its secret number? 32 ## Checkpoint 2 - -5. What is the polyalphabetic secret word? +# 4-11-2026 +5. What is the polyalphabetic secret word? PYTHON 6. Decrypt this message, which was encrypted using the same secret word: "EbZhdaV[h^bTpchhQnhig]X[VmhhRP]ftXVnRfjVY]fgtO_X](" +>>> from ciphers.poly import PolyCipher +>>> cipher = PolyCipher('PYTHON') +>>> cipher.decrypt('EbZhdaV[h^bTpchhQnhig]X[VmhhRP]ftXVnRfjVY]fgtO_X](') +'The treasure is a worthless ball of aluminum foil.' diff --git a/caesar_cracker.py b/caesar_cracker.py index 4e1dc28..498c651 100644 --- a/caesar_cracker.py +++ b/caesar_cracker.py @@ -74,6 +74,7 @@ from ciphers.caesar import CaesarCipher # ciphertext="|J@[DA=REHU[BNKI[SKA[PK[SKA[PAHH[KbAN0DA[O=@[=??KQJP[KB[BKNAh>AIK=JA@[IK=Jg3DE?D[%[JAS[L=U[=O[EB[JKP[L=E@[>ABKNAi}QP[EB[PDA[SDEHA[%[PDEJG[KJ[PDAAg[@A=N[BNEAJ@g|HH[HKOOAO[=NA[NAOPKNb@g[=J@[OKNNKSO[AJ@i" +# secret4.txt # ciphertext="""l"5&@a6(645L@(*7&/@)&"7:@3"*/@"/%@46/f03@"@'6--@8&&,L@5)&@#-"$,#&33*&4@806-%@3*1&/Na5@'*345L@+645@0/&L@"@(-044:@1631-&@$-05a.0/(@05)&34L@3&%L@(3&&/L@)"3%@"4@"@,/05N""" # use triple quotes before and after the string @@ -85,7 +86,28 @@ from ciphers.caesar import CaesarCipher # ciphertext="""w&@)0"3%&%@5)&@'3&4)@#&33*&4@*/@5)&@#:3&Nb65@8)&/@5)&@#"5)@8"4@'*--&%@8&@'06/%@"@'63La@3"5M(3&:@'6/(64L@(-655*/(@0/@063@$"$)&Nt)&@+6*$&@8"4@45*/,*/(@500N@o/$&@0''@5)&@#64)""" -ciphertext="""t)&@'36*5@'&3.&/5&%L@5)&@48&&5@'-&4)@806-%@563/@4063Ni@"-8":4@'&-5@-*,&@$3:*/(N@i5@8"4/G5@'"*3t)"5@"--@5)&@-07&-:@$"/'6-4@4.&-5@0'@305Ne"$)@:&"3@i@)01&%@5)&:G%@,&&1L@,/&8@5)&:@806-%@/05N""" +# ciphertext="""t)&@'36*5@'&3.&/5&%L@5)&@48&&5@'-&4)@806-%@563/@4063Ni@"-8":4@'&-5@-*,&@$3:*/(N@i5@8"4/G5@'"*3t)"5@"--@5)&@-07&-:@$"/'6-4@4.&-5@0'@305Ne"$)@:&"3@i@)01&%@5)&:G%@,&&1L@,/&8@5)&:@806-%@/05N""" + + +# checkpoint 2 - polyalphabetic encryption/decryption + +# ciphertext=":y]JfTp\j[YTUyiQUnd_X[UcpngNQbflZhY]pgnhRPTenJbS|yjWTTcyiQUn`[`hdaV_#" + +# length of keyword is probably 6 + +# 6 columns - now use frequency analysis and monoalphabetic encryption/decryption + +# ciphertext=":pUdpfpT|c`V" + +# ciphertext="y\y_nlgeyy[_" + +# ciphertext="]jiXgZnnji`#" + +# ciphertext="J[Q[NhhJWQh" + +# ciphertext="fYUUQYRbTUd" + +ciphertext="TTncb]PSTna" data=Counter(ciphertext) @@ -103,12 +125,14 @@ key_value=keys_list[idx] # apply that same variable to the keys list # #print(values_list.index(v)) - prints the index number # print(key_value) -secret=Bits(str(key_value)).int - Bits(' ').int # monoalphabetic offset number +print(data) -# print(secret) # secret number +secret=Bits(str(key_value)).int - Bits('e').int # monoalphabetic offset number + +print(secret) # secret number cipher = CaesarCipher(secret) # I get a runtime warning message referencing -# the variable "ciphertext" - invalid escape sequence. +# the variable "ciphertext" - invalid escape sequence. cipher.decrypt(ciphertext) print(cipher.decrypt(ciphertext))