ClatSecure Encryption Key Generator
This project implements AES key generation and encryption utilities in Python, including:
- 128-bit, 192-bit & 256-bit AES encryption key generation using Argon2i for key derivation.
- AES key expansion and encryption round functionality with S-Box, Rcon, and XOR operations.
- Generates secure AES keys with high entropy.
- Supports encryption rounds compliant with AES.
- Provides functionality for key expansion, round transformations, and state operations.
The following libraries are needed to run the script:
- os: For generating secure random salts.
- numpy: For efficient matrix manipulations and transformations.
- argon2-cffi: For cryptographic key derivation using Argon2.
- pystyle for branding
Install the dependencies using pip:
pip install numpy argon2-cffi pystyle
Keys are derived from a password using Argon2i with a randomly generated 16-byte salt. This ensures secure and reproducible keys, ideal for cryptographic purposes.
The generated key undergoes an expansion process to create round keys used during encryption:
- Rcon and S-Box operations are applied for non-linear transformations.
- Intermediate keys are XORed to create the expanded keys for each round.
The state matrix is transformed in the following sequence:
- SubBytes: Substitutes bytes using the AES S-Box.
- ShiftRows: Rotates rows of the state matrix.
- MixColumns: Combines columns (simplified in this implementation).
- AddRoundKey: XORs the state with the current round key.
The final round omits the MixColumns step:
- SubBytes
- ShiftRows
- AddRoundKey
- Enter a password (for key deriviation) when prompted. The script will generate 100 AES keys, apply the encryption rounds, and display the final state in hexadecimal format.
- Open the python file.
Enter password: mypassword Final state (hexadecimal): C0A1B2C3D4E5F60789AB12CD34EF5678
- MixColumns: This implementation uses a simplified version, not the GF(2^8) operations defined in the AES standard.
- Encrypting sensitive data using AES encryption.
- Secure password-derived key generation for cryptographic use.
- Testing and learning cryptographic algorithms.
This project is open-source under the Apache 2.0 License.
Contributions are welcome! Feel free to open issues or submit pull requests to improve functionality or compliance with AES standards.
Histograms of outputs: