This project implements a modified version of the AES-256 encryption algorithm. The enhancements include a dynamic SBox substitution mechanism powered by a ChaCha20-based pseudo-random number generator (PRNG) and flexible parameterization to explore new cryptographic techniques. This implementation provides a balance between strong encryption and a modular design for customization and experimentation.
- Utilizes a ChaCha20-based PRNG to dynamically generate constants for SBox substitution.
- Enhances security by introducing round-dependent randomness to the substitution process.
- Increases resilience against attacks targeting static substitution tables.
- Retains the core AES structure with 14 rounds of transformations.
- Includes:
- AddRoundKey: XORs the state with round-specific keys.
- Dynamic SBox Substitution: Replaces static SBoxes with PRNG-generated transformations.
- ShiftRows: Circular byte shifts for diffusion.
- MixColumns: Multiplication in GF(2^8) for further diffusion in encryption; InverseMixColumns for decryption.
- Generates pseudo-random values for SBox transformations.
- Incorporates a 256-bit seed and round-dependent input to ensure unique outputs for each encryption round.
- Parameterized for easy experimentation with:
- Number of rounds (default: 14).
- Key size (default: 256 bits).
- Custom PRNG integration.
- Implements inverse transformations:
- InverseShiftRows: Reverses the byte shifts.
- InverseSubBytes: Uses PRNG outputs to reverse dynamic SBox transformations.
- InverseMixColumns: Undoes column mixing for decryption.
The system is designed using modular Verilog code, with each AES transformation encapsulated in its module:
- Encryption Path: Implements the full encryption process, including MixColumns for rounds 1–13 and the final round with no mixing.
- Decryption Path: Mirrors the encryption process using inverse transformations, with InverseMixColumns applied in all rounds except the final round.
- Key Expansion Module: Generates round keys for all transformations.
- PRNG Module: Dynamically generates round-specific constants.
-
Encryption Module:
- Chains all AES rounds with dynamic SBox substitutions and applies MixColumns in rounds 1–13 for diffusion.
- The last round skips MixColumns but still applies the other transformations.
- Displays intermediate states for debugging and verification.
-
Decryption Module:
- Applies inverse transformations in reverse order for seamless plaintext recovery, skipping InverseMixColumns in the last round.
-
PRNG:
- ChaCha20-inspired generator ensures reproducible randomness for cryptographic strength.
In the encryption process, each round involves the following transformations:
- AddRoundKey: The plaintext is XORed with a round key.
- Dynamic SBox Substitution: The bytes are substituted using a dynamic SBox generated by the ChaCha20-based PRNG.
- ShiftRows: The rows are cyclically shifted.
- MixColumns: For rounds 1–13, the bytes undergo a matrix multiplication in GF(2^8), spreading the influence of each byte across the columns.
The last round (round 14) skips MixColumns and performs the following:
- AddRoundKey.
- Dynamic SBox Substitution.
- ShiftRows.
In the decryption process, the operations are applied in reverse order:
- AddRoundKey: The ciphertext is XORed with the round key in reverse.
- InverseSubBytes: Each byte is substituted using the inverse of the dynamic SBox.
- InverseShiftRows: The rows are cyclically shifted back to their original position.
- InverseMixColumns: For rounds 1–13, the inverse of the MixColumns operation is applied to undo the mixing in the encryption process.
The last round (round 14) skips InverseMixColumns and performs the following:
- AddRoundKey.
- InverseSubBytes.
- InverseShiftRows.
- Integration of UVM and proper test benches to test it against benchmarks effectively.
- Optimizations for FPGA and ASIC implementations.
- Exploration of hybrid cryptographic techniques by combining AES with other ciphers.
- Clone the repository.
- Simulate the design using a Verilog simulator (e.g., ModelSim, Vivado).
- Use the provided basic test benches provided to encrypt and decrypt.
We welcome contributions to:
- Improve the modularity of the code.
- Enhance the randomness mechanisms.
- Test the implementation against known cryptographic attacks.
Inspired by the principles of AES and ChaCha20, this project combines the strengths of both algorithms to push the boundaries of cryptographic design.