import unittest
import base64
from py3rijndael import Rijndael
def test_rijndael():
key = 'qBS8uRhEIBsr8jr8vuY9uUpGFefYRL2HSTtrKhaI1tk='
print(len(key))
a=input("Please Enter Plain text: ")
plain_text=a.encode('utf-8')
rijndael = Rijndael(base64.b64decode(key), block_size=32)
padded_text = plain_text.ljust(32, b'\x1b')
cipher = rijndael.encrypt(padded_text)
cipher_text = base64.b64encode(cipher)
pl_txt=rijndael.decrypt(cipher)
pl_txt[:len(plain_text)]
return cipher_text
在上面的代码中,我想为安全私钥生成一个随机密钥 更改键中的任何字符以进行ex:making key='qBS8uRhEIBsr8jr8vuY9uUpGFefYRL2HSTtrKhaI1tk+'或其他东西,使测试失败,密钥大小无效。有人能帮忙吗。
目前没有回答
相关问题 更多 >
编程相关推荐