擅长:python、mysql、java
<p><strong>尝试:</strong></p>
<pre><code>cipher_text = input("Enter the Cipher Text = ")
length = len(cipher_text)
plain_text = ""
i = 0
key = 1
while key < 26:
plain_text = ""
while i < length:
if ord(cipher_text[i]) - key < 32:
plain_text += chr(ord(cipher_text[i]) - key + 95)
else:
plain_text += chr(ord(cipher_text[i]) - key)
i += 1
i = 0
print("Decrypting cipher text with key ", key, "is", plain_text)
key += 1
</code></pre>
<p><strong>输出:-</strong></p>
^{pr2}$
<p><strong>p.S.</strong>您提供的密码不是Caesar密码,而是修改后的Caesar密码。两者之间的区别在于Caesar密码使用常量密钥(key=3),但是修改后的Caesar密码可以使用可变密钥(0<;key<;26)。在</p>