1.传统的pycrypto已经不更新了有很多bug 导致 CFB模式有问题,网上的99%都是错的,要用pycryptodome包
https://github.com/Legrandin/pycryptodome
2.包出现问题应该去github看wiki或者bug 搜关键词
3.以下是代码
def AES_128_CFB(String): cryptor = AES.new(key=key, mode=AES.MODE_CFB, IV=iv,segment_size=128) ciphertext = cryptor.encrypt(String) return base64.b64encode(ciphertext) def AES_128_CFB_decode(String): decode = base64.b64decode(String) cryptor = AES.new(key=key, mode=AES.MODE_CFB, IV=iv,segment_size=128) plain_text = cryptor.decrypt(decode) return plain_text def get_encode_data(message): cryptor = AES.new(key=key, mode=AES.MODE_CFB, IV=iv, segment_size=128) ciphertext = cryptor.encrypt(message) return