Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The target is to decrypt the following ciphertext to the plaintext(simple test is provide), the possible key is length 12 from 0-25: plaintext_test = THEWORLDISNO

The target is to decrypt the following ciphertext to the plaintext(simple test is provide), the possible key is length 12 from 0-25:

plaintext_test = "THEWORLDISNO" (this is a simple test with answer) key_test = [3,9,3,9,3,9,3,9,3,9,3,9] ciphertext_test = 'HHCAOLNVMOFC' plaintext_known = "TOMORROWNEVERDIESFORYOUREYESONLYONHERMAJESTYSSECRETSERVICEIN" ciphertext_known = 'RSMYFLKOBITSFNYIMJKHKECFSGKUKTBWQHPSFKWDSWZWYSQAFERUSLFKSIGV' ciphertext_960_english = 'BRCMUYQNQJSSEODNENQWVWBZUIAUZSUECWGPMDGMDHUUOSYOAPQKGUYATVYHFUGDWHQJKIGEEBGMSIVANOSPBRCMNGUCCIIEVTCFENIATLBNWKVDFIBKASEEEPJDFSDCTOZZUBKCEYATAJMGULTYDSDBGGZHMLTYRWWOEDIHOQCDFSBMJKGZUYTXAUDECSCNBREUQHKJQLQWBOVRDHWNYWVEELCDTUBKASGPUPDOEMDIJVYHFOVKDHWNWOHLZEXYBMUEEONQWLCDETWJSOSKUYTDBSDLASZPVCXWXGKIEKZZMEXSRMYIGGFWJYCDUYFMWFDAUINVGTQVFQZZWLIHSKQNEOSNFHSSTZGJABNIWWXHUYYIBQEWBREUDIXIVEIFWKJWZIDIJFAVUFQWSPUJDQPFUBJWSJARGNYSKZEFQEUNWDCPEPIDUGDKASFUHMBYQUTGBOSPWBSTDNGSIZQZWZJDGTTGGUOEFMIMWAVXGJQGWCOYEKPIKJMUDPEZDHWOCOYOWBMSYAIIQLYSMZCIRJGLGIZZUSDIDJGTKISSEODXAGXADKMZLZSESADQSWPLWPDWBILAVWMVWNTCUJFIQNYPPZSMMVBACESORKOURUKEGZVMBLTYOSKAEWQFMZMIDGHGCSNIWFFIKUGNUMHWYLFYTUBMAJYSWSCFEEYEVWZIWSNWOYWVFQIFWPD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AVQREHUSNUDOEIPXMLQEIHKBIPQDEVQCZCUHBSBYFUWGLLDOTABXRUZSLOWEBIQSYBUBYKUMIETCGUWUSWDOMACMEBZSTUMHKYMOHZGJRUHOXJVOJZAHNVUQIAKOJZNKWWNOOGEUECVUELHOOGIGKRQWQOIMIZCSWSLTIWTSANMDECAEIFOMKJQLUWNNIHUYASCSVXDGEWXSVJQFTOGZZUDCXIJYVAEHILICEAPOTOGZTMKKGYQLERATQUCKIETYCSQWYKULG' ciphertext_96_unknown = 'LIUYQPGWNFUCJHDORXSCUMZOWVNWTSEQMIUXKVZWBAUPAKIJDEQBAPELSPSSFLABAPGWNFFCQJVTORHAXCHCGLRYBS'

code is here:

alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"

def my_encrypt(plaintext, key): ciphertext=[] invmulttext=[] vigtext=[]

for i in range(len(plaintext)): place_alpha= alphabet.find(plaintext[i]) invmult_place= (place_alpha*(key[i%12]^(-1)))%26 invmulttext.append(alphabet[invmult_place]) place_inalpha = alphabet.find(invmulttext[i]) vig_place = (place_inalpha + key[(i+1)%12])%26 vigtext.append(alphabet[vig_place]) alpha_place = alphabet.find(vigtext[i]) shifted_place = (alpha_place + key[1]) % 26 ciphertext.append(alphabet[shifted_place]) return "". join(ciphertext)

def my_decrypt(ciphertext,key): withoutshift=[] withoutvig=[] plaintext=[]

for i in range(len(ciphertext)): place_alpha = alphabet.find(ciphertext[i]) unshifted_place = (place_alpha - key[1]) % 26 withoutshift.append(alphabet[unshifted_place]) placein_alpha = alphabet.find(withoutshift[i]) vigless_place = (placein_alpha - key[(i+1)% 12])%26 withoutvig.append(alphabet[vigless_place]) mult_alpha= alphabet.find(withoutvig[i]) mult_place= (mult_alpha*key[i%12])%26 plaintext.append(alphabet[mult_place]) return "". join(plaintext)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions