Now, let's play with a simple AES encrypt / decrypt example. Next, install the Python library pbkdf2 that implements the PBKDF2 password-to-key derivation algorithm: pip install pbkdf2 Install Python Libraries pyaes and pbkdf2įirst, install the Python library pyaes that implements the AES symmetric key encryption algorithm: pip install pyaes Let's start with simple AES-256-CTR non-authenticated encryption. The next example will add message authentication (using the AES-GCM mode), then will add password to key derivation (AES-256-GCM + Scrypt).
The first example below will illustrate a simple password-based AES encryption (PBKDF2 + AES-CTR) without message authentication ( unauthenticated encryption). Let's illustrate the AES encryption and AES decryption concepts through working source code in Python. AES Encryption / Decryption (AES-CTR, AES-GCM) - Examples in Python