A Caesar cipher is a simple substitution cipher based on the idea of shiftingeach letter of the plaintext message a fixed number (called the key) ofpositions in the alphabet. For example, if the key value is 2, the word"Sourpuss" would be encoded as "Uqwtrwuu." The original message canbe recovered by "reencoding" it using the negative of the key. Write a program that can encode and decode Caesar ciphers. The in-put to the program will be a string of plaintext and the value of the key. The output will be an encoded message where each character in the orig-inal message is replaced by shifting it key characters in the Unicode char-acter set. For example, if ch is a character in the string and key is the amount to shift, then the character that replaces ch can be calculated as:chr (ord(ch) + key) .
A Caesar cipher is a simple substitution cipher based on the idea of shifting
each letter of the plaintext message a fixed number (called the key) of
positions in the alphabet. For example, if the key value is 2, the word
"Sourpuss" would be encoded as "Uqwtrwuu." The original message can
be recovered by "reencoding" it using the negative of the key.
Write a program that can encode and decode Caesar ciphers. The in-
put to the program will be a string of plaintext and the value of the key.
The output will be an encoded message where each character in the orig-
inal message is replaced by shifting it key characters in the Unicode char-
acter set. For example, if ch is a character in the string and key is the
amount to shift, then the character that replaces ch can be calculated as:
chr (ord(ch) + key) .

Step by step
Solved in 2 steps with 2 images









