import random,string
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']
d=[]
c=[]
ct=[]
while (len(ct)<26):
r=random.choice(string.ascii_letters)
if r not in ct:
ct.append(r)
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)
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']
d=[]
c=[]
ct=[]
while (len(ct)<26):
r=random.choice(string.ascii_letters)
if r not in ct:
ct.append(r)
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