Ceaser Cipher Encryption
Question:
Ceaser cipher Encrytion.
Input:
Plaintext : rajesh
key : 3
Output:
udmhvk
program:
def ceaser(a,b):
z=[]
c=[]
for i in a:
if(i=='z' or i=='Z'):
x=ord(i)+b-26
else:
x=ord(i)+b
z.append(x)
d=chr(x)
c.append(d)
cipher=""
for i in c:
cipher+=i
return(cipher)
a=str(input("Enter plain text:"))
b=int(input("Enter key:"))
print('Ceaser cipher:'+ceaser(a,b))
Ceaser cipher Encrytion.
Input:
Plaintext : rajesh
key : 3
Output:
udmhvk
program:
def ceaser(a,b):
z=[]
c=[]
for i in a:
if(i=='z' or i=='Z'):
x=ord(i)+b-26
else:
x=ord(i)+b
z.append(x)
d=chr(x)
c.append(d)
cipher=""
for i in c:
cipher+=i
return(cipher)
a=str(input("Enter plain text:"))
b=int(input("Enter key:"))
print('Ceaser cipher:'+ceaser(a,b))
Comments
Post a Comment