Skip to main content
 首页 » 编程设计

python之将二进制数据加密为二进制数据并解密

2025年02月15日19dudu

<分区>

我想将二进制数据加密成二进制,然后再以二进制解密。我怎么能在 python 中做到这一点?我尝试使用 AES 但未能成功。

 Key = '00000000’ 
 des = DES.new(key', DES.MODE_ECB) 
 plain_text = "10101011" 
 #encryption 
 cipher_text = des.encrypt(plain_text) 
 #decryption 
 decrypted_pt = des.decrypt(cipher_text)