Encryption using Ceaser Cipher
Encryption using Ceaser Cipher
Algorithm:
Step 1: Start
Step 2: Take input from user and store it in a variable txt
Step 3: Start loop length of variable txt
Step 4: In loop convert each character into ASCII code
Step 5: If ascii code is greater then equals 0 to less then equals 124 then incre-
ment it by 3 and append it in list
Step 6: Else If ascii code is equals to 125 then append 0
Step 7: Else If ascii code is equals to 126 then append 1
Step 8: Else If ascii code is equals to 127 then append 2
Step 9: Start loop of length list
Step 10: Convert each ASCII code to character and concat it in variable enc
Step 11: Print enc variable (Encrypt message)
Step 12: End
Program Screenshot
Program Code:
nLst = []
txt = input("Enter Your Name: ")
for i in txt:
n = ord(i)
if n >= 0 and n <= 124:
nLst.append(n+3)
elif n == 125:
nLst.append(0)
elif n == 126:
nLst.append(1)
elif n == 127:
nLst.append(2)
# print(chr(35))
#print(nLst)
enc=""
for i in nLst:
enc += "".join((chr(i)))
Program Output:
Test Case 1:
Test
Case 2:
Test Case 3: