Computer Science, asked by whyyou938, 5 months ago

The Caesar Cipher technique is one of the earliest and simplest method of encryption technique. It's simply a type of substitution cipher, i.e., each letter of a given text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, A would be replaced by B, B would become C, and so on. Retrieve the whole plaintext from the following ciphertext with key 12:
UFUEN QFFQD FANQT MFQPR ADITM FKAGM DQFTM ZFANQ XAHQP
RADIT MDQZAF

Answers

Answered by jai696
5

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

from string import ascii_uppercase as alphas

def caesar_cipher_decrypt(s, k):

decrypted_msg = ""

for c in list(s):

if c in alphas:

c_idx = (alphas.find(c) - k) % len(alphas)

decrypted_msg += alphas[c_idx]

else:

decrypted_msg += c

return decrypted_msg

for x in [

"UFUEN QFFQD FANQT MFQPR ADITM FKAGM",

"DQFTM ZFANQ XAHQP",

"RADIT MDQZAF"

]:

print(caesar_cipher_decrypt(x, 12))

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions