Standards Implementation (C/Java/Python)

Nov 1, 2023 · 2 min read

AES (Advanced Encryption Standard)

As part of my cryptography project, I developed a complete implementation of the AES in the C programming language following the FIPS 197 standard. This project includes the creation of a program capable of encrypting and decrypting files using both ECB and CBC modes.

My program runs from a terminal and supports several options, such as selecting the encryption key, choosing the encryption mode (ECB by default, CBC optional), and displaying the results in hexadecimal format. An integrated user manual allows users to view the available commands.

For the AES implementation, I used tables generated via SageMath for the S-boxes and polynomial-exponentiation transformations. I also developed specific procedures to handle conversions as for instance : hexadecimal (within a string) to int.

DSA (Digital Signature Algorithm)

In my project on implementing the DSA as specified by the FIPS 186-3 standard, I focused on leveraging existing functions from the BigInteger module (multiprecision library) to streamline the development process. Indeed, BigInteger provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, and bit manipulation on large integers needed for the signature.

The signature needs a hash function, thus I used the SHA-1 hash function.

This project was a holiday assignment to prepare for my Master’s 2 studies and to gain some experience with Java. I learned how to handle classes to manage private and public keys (x, y) and the signature parameters (r, s). This setup facilitates the generation of new key pairs and signatures using the “new” command and allows for updates as needed.

Midori-64

Midori-64 is actually a cryptographic algorithm, specifically a lightweight block cipher.

This cipher encrypts 64-bit blocks using a 128-bit key. The algorithm performs 16 rounds of encryption, where each round involves several key components: SubCells for nonlinear substitution (adding confusion), MixColumn for linear transformation (ensuring diffusion), ShiftRows for rearranging bits across rows, and AddRoundKey, which applies a XOR with a round key to the data.

My Python implementation of Midori-64 is a simplified version of the standard. Specifically, some round constants are omitted. The primary objective was to conduct differential cryptanalysis on this cipher as part of a Symmetric Cryptanalysis course. Omitting the additional constants made it easier to understand and identify differential trails.