a=input("Enter the msg: ")
pt=[]
print ("Decrypted Data")
for key in range(1,27):
for i in a:
if ord(i)>=97 and ord(i)<=122:
d=(((ord(i)-key)-97)%26)+97
pt.append(chr(d))
elif ord(i)>=62 and ord(i)<=90:
d=(((ord(i)-key)-65)%26)+65
pt.append(chr(d))
str2 = ''.join(pt)
print ("Key %d = %s" % (key,str2))
pt=[]
pt=[]
print ("Decrypted Data")
for key in range(1,27):
for i in a:
if ord(i)>=97 and ord(i)<=122:
d=(((ord(i)-key)-97)%26)+97
pt.append(chr(d))
elif ord(i)>=62 and ord(i)<=90:
d=(((ord(i)-key)-65)%26)+65
pt.append(chr(d))
str2 = ''.join(pt)
print ("Key %d = %s" % (key,str2))
pt=[]
Screenshot:
No comments:
Post a Comment