你好,我正在尝试暴力解密一个单词 58 次,但我的代码不断为它执行的每个循环添加更多字符。有没有人知道我做错了什么我刚学了 python 3
这是我的解密尝试
word = input("Please enter the encrypted word: ")
message = ""
times = 0
for i in range(58):
for ch in word:
val=ord(ch)
times += 1
val = (val-times)
if val > ord('z'):
val = ord('a') + (val - ord('z')-1)
message +=chr(val)
print("Here is your original message: ", message)
请您参考如下方法:
这是您要找的吗?
word = input("Please enter the encrypted word: ")
message = ""
times = 0
for i in range(58):
message = ""
for ch in word:
val=ord(ch)
val = (val-times)
if val > ord('z'):
val = ord('a') + (val - ord('z')-1)
message +=chr(val)
print("Here is your encrypted message: ", message)
times += 1
知道使用了哪种加密方式会使这个问题更容易解决。
