使用Casesar Cipher algorithm,我试图让它解密我输入的任何内容。
#Decrypt Code
alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ "
DMessage=input("Enter your message to decrypt")
UDMessage=DMessage.upper()
lenDMessage=len(UDMessage)
offset=(int(input("Enter what you would like your offset to be 0,25")))
offset=offset-2
for x in range(0,lenDMessage):
for y in range(-25,25):
if UDMessage[x]==alphabet[y+25]:
print(x,DMessage,[x], UDMessage[x],alphabet[y+25+offset])
输入为Caesar code test run
,但输出为ecguctbeqfgbvgubbtwp
。有谁知道如何制作它,所以我可以倒退字母表来解密它?