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))

Comments

Popular posts from this blog

Software Freedom Day 2020

gobuster

Addition Game