Caesar Cipher algorithm steps:
Encryption:
1. Choose a shift value:
Select an integer between 1 and 25. This will be the number of positions to shift each
letter.
2. Shift the letters:
For each letter in the message, find its corresponding letter in the alphabet shifted by the
chosen value. If the shift brings you past 'Z', wrap around to the beginning of the alphabet
(e.g., shifting 'X' by 3 would result in 'A').
3. Replace letters:
Substitute each letter in the original message with its shifted counterpart to create the
encrypted message.
Python ord()
Python ord() function takes string argument of a single Unicode character and return its integer Unicode
code point value. Let’s look at some examples of using ord() function.
x = ord('A')
print(x)
print(ord('ć'))
print(ord('ç'))
print(ord('$'))
Output:
65
263
231
36
Python chr()
Python chr() function takes integer argument and return the string representing a character at that code
point.
y = chr(65)
print(y)
print(chr(123))
print(chr(36))
Output:
A
{
$
ć