pycrypto
pycryptodome
https://pypi.org/project/pycryptodome/ [Unix] https://pypi.org/project/pycryptodomex/ [Windows]
import jsontry:from Cryptodome.Cipher import AESfrom Cryptodome.Random import get_random_bytesexcept ImportError:from Crypto.Cipher import AESfrom Crypto.Random import get_random_byteskey = get_random_bytes(16)iv = get_random_bytes(16)print(f'key: {key}')print(f'iv: {iv}')data = {'data': [i for i in range(10)], 'msg': 'success'}message = json.dumps(data)print(message.encode())cipher = AES.new(key, AES.MODE_EAX, iv)enc_message = cipher.encrypt(message.encode())print(enc_message)cipher = AES.new(key, AES.MODE_EAX, iv)dec_message = cipher.decrypt(enc_message)print(dec_message.decode())
cryptography
crypto-js
https://www.npmjs.com/package/crypto-js https://cryptojs.gitbook.io/docs/
aes-js
- https://www.pycryptodome.org/en/latest/src/cipher/classic.html?highlight=padding#cfb-mode-1
- https://www.cnblogs.com/linuxcat/p/14494630.html
- https://blog.csdn.net/chouzhou9701/article/details/89339625
- https://zhuanlan.zhihu.com/p/184968023
- https://www.cnblogs.com/planetwithpig/p/14143113.html
- https://cryptojs.gitbook.io/docs/#ciphers
