信息安全原理
作业1,习题3
MAL TIRRUEZF CR MAL RKZYIOL EX MAL OIY UAE RICF “MAL ACWALRM DYEUPLFWL CR ME DYEU MAIM UL IZL RKZZEKYFLF GH OHRMLZH”
看起来似乎是某某某说过一句怎样的话
先写个程序,用来翻译每个大写字母对应的字母
cipher = 'MAL TIRRUEZF CR MAL RKZYIOL EX MAL OIY UAE RICF MAL ACWALRM DYEUPLFWL CR ME DYEU MAIM UL IZL RKZZEKYFLF GH OHRMLZH'
def init_letter(cipher):
''' init the key for cipher'''
key = {' ':' '}
for i in range(ord('A'), ord('A')+26):
key[chr(i)] = '_'
return key
def convert_letter(cipher, key, fr, to):
'''convert the cipher to plaintext with key'''
key[fr] = to
cipher_len = len(cipher)
plainText = ''
for i in range(cipher_len):
plainText += key[cipher[i]]
print(