Thursday, April 25, 2019

Encryption and Decryption using Monoalphabetic Cipher Technique - System Security | Python3

a=input("Enter the msg: ")
pt=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ct=['r','s','t','u','v','w','x','y','z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q']
d=[]
c=[]

for i in a:
    b=pt.index(i)
    d.append(ct[b])
str1 = ''.join(d)
print ("Encrypted Text: "+str1)

for j in d:
    b=ct.index(j)
    c.append(pt[b])
str2 = ''.join(c)
print ('Decrypted Text: '+str2)

Screenshot:

No comments:

Post a Comment