For programmers to need to encrypt and decrypt data with AES by python,this tested source code is useful.
It is available to generate AES key and encrypt/decrypt text or binary data,files.
Specification
ID | STCD_0000000003 |
Language | Python |
Steps | 138 |
Purpose | Encrypt and Decrypt data with AES. |
Function | Encrypt data with AES(CBC/CFB/OFB/EAX/GCM/CTR). Decrypt data with AES(CBC/CFB/OFB/EAX/GCM/CTR). |
Environment | Anaconda3(Python 3.9.7) IDE : Visual Studio Code PyCryptodome |
Restriction | free license You can use source code copy as owner . You can customize and distribute it freely. |
Price | 7 dollars or 700 yen (Pay with PayPal) |
References | https://pycryptodome.readthedocs.io/en/latest/src/examples.html https://docs.python.org/ja/3/library/hashlib.html https://www.python.ambitious-engineer.com/archives/1069 https://telecom-engineer.blog/blog/2022/02/04/python-crypto-aes-ctr/ https://qiita.com/shimajiri/items/ffaf84280db257531437 https://en.wikipedia.org/wiki/EAX_mode https://pycryptodome.readthedocs.io/en/latest/src/cipher/aes.html https://telecom-engineer.blog/blog/2022/02/04/python-crypto-aes-ctr/ |
Source Code







Test Result
NO | test case | result |
01 | mode pattern test with text data – Change aes encryption mode(CBC/CFB/OFB/EAX/GCM/CTR) | OK |
02 | mode pattern test with binary data) – Change aes encryption mode(CBC/CFB/OFB/EAX/GCM/CTR) | OK |
03 | file pattern test – text file and image file | OK |
Test Code
*) Modify “path” along your PC environment.







History
20/11/2022 created
Provider Profile
Nick name is “Dead Fish” employed as an engineer in Japan.
I am grad if you need my code.
Thanks !
Download
Get download passwordFollowing files and data are zipped.
├── AesClass.py ├── test_image.png ├── test_image_out.png ├── test_text.txt └── test_text_out.txt
Remarks
None
Comments