0% found this document useful (0 votes)
20 views

Encryption using Ceaser Cipher

The document outlines an assignment for implementing encryption using the Caesar Cipher algorithm. It provides a step-by-step algorithm and corresponding Python code to encrypt user input by manipulating ASCII values. The program takes a string input, modifies its ASCII codes, and outputs the encrypted message.

Uploaded by

sijesim421
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Encryption using Ceaser Cipher

The document outlines an assignment for implementing encryption using the Caesar Cipher algorithm. It provides a step-by-step algorithm and corresponding Python code to encrypt user input by manipulating ASCII values. The program takes a string input, modifies its ASCII codes, and outputs the encrypted message.

Uploaded by

sijesim421
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment Number: 1

Assignment Name: 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)))

print("Encrypt message is: ",enc)

Program Output:

Test Case 1:
Test
Case 2:

Test Case 3:

You might also like