# Trying Following 1 Find Weakness Cryptosystem 2 Guess Possible Plaintext Given Ciphertext Q35631026

Trying to do the following:

1. Find the weakness in the below cryptosystem.

#### How many pages is this assigment?

2. Guess the possible plaintext by the given ciphertext andalgorithms below.

For instance, given ciphertext ‘HHCAOLNVMOFC’, finding right thekey [3,9,3,9,3,9,3,9,3,9,3,9] can find the plaintext”THEWORLDISNO”

(The desired plaintext for ciphertext 1 and 2 are readableEnglish paragraph)

Given ciphertext1:

Given ciphertext2:

‘ENEXUEAWTBSAFCOHCTEVDENWRYCWBUDKDYSBTIXLPWXIIWVDENSIHVSZDENWANXAGYSZAGVITZEVBMGPURIBSKEDMDOASLJW’

Given ciphertext3:

Given ciphertext4:

‘LIUYQPGWNFUCJHDORXSCUMZOWVNWTSEQMIUXKVZWBAUPAKIJDEQBAPELSPSSFLABAPGWNFFCQJVTORHAXCHCGLRYBS’

algrithom 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)

In [3]: alphabet-“ABCDEFGHIKMOPRSTUVWXYZ” In [1]: 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[1%12]^(-1)))%26 invmulttext.append (alphabet[invmult_place]) place_inalphaalphabet.find(invmulttext[i]) vig-place- (place-inalpha + key[(1+1)X12])%26 vigtext.append(alphabet[vig_place]) alpha_placealphabet.find(vigtext[i]) shifted-place- (alpha-place + key[1]) % 26 ciphertext.append(alphabet[shifted_place]) return “”. join(ciphertext) In [2]: 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(without shift [i]) vigless-place- (placein-alpha – key [ (1+1)% 12])%26 withoutvig.append (alphabet[vigless_place]) mult alpha- alphabet.find(withoutvig[il) mult-place- (mult-alpha”key [ 1%121)%26 plaintext.append (alphabet[mult_place]) return “”. join (plaintext) Show transcribed image text In [3]: alphabet-“ABCDEFGHIKMOPRSTUVWXYZ” In [1]: 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[1%12]^(-1)))%26 invmulttext.append (alphabet[invmult_place]) place_inalphaalphabet.find(invmulttext[i]) vig-place- (place-inalpha + key[(1+1)X12])%26 vigtext.append(alphabet[vig_place]) alpha_placealphabet.find(vigtext[i]) shifted-place- (alpha-place + key[1]) % 26 ciphertext.append(alphabet[shifted_place]) return “”. join(ciphertext) In [2]: 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(without shift [i]) vigless-place- (placein-alpha – key [ (1+1)% 12])%26 withoutvig.append (alphabet[vigless_place]) mult alpha- alphabet.find(withoutvig[il) mult-place- (mult-alpha”key [ 1%121)%26 plaintext.append (alphabet[mult_place]) return “”. join (plaintext) Asked Mar. 09, 2019

The post Trying Following 1 Find Weakness Cryptosystem 2 Guess Possible Plaintext Given Ciphertext Q35631026 appeared first on Nurses Den.