This project is a c++ implementation of differential cryptanalysis attack to K-Cipher. The project contains the following files;
KCipher.h
: Includes headers for the functions of K-Cipher.KCipher.cpp
: Includes the implemenation of the functions of K-Cipher.main.cpp
: Includes the attack.CMakeLists.txt
: cmake file for running the code
To run the attack, run the following commands in the root directory of the project:
cmake .
make
./K_Cipher
The first phase of the attack is to recover attack_round_3();
.
For each block, the function recovers two candidates for
This round recovers attack_round_2();
.
For this attack, we used the fact that we can change the order of xor and BitReordering and also distribute circular shift over modular addition (which works with probability 0.41 for 8-bit SBox).
The values return by the function are
This round recovers attack_round_1();
.
For this attack, we used the fact that we can change the order of xor and BitReordering and also distribute circular shift over modular addition (which works with probability 0.41 for 8-bit SBox).
All the values recovered can are in the same equivalence classes and can be used to simulate the circuit.
This can be done using equation solving. There is no Sbox and with a pair of plaintext and partially decrypted ciphertext, one can recover these values.
Please note that the code is only tested on Ubuntu machine (5.13.0-27-generic x86_64
). To run on other platforms please make sure that the
randomness generation has sufficient entropy.