The speck_diff_find and speck_line_find are python framework for automatic differential and linear cryptanalysis which are developed based on the method presented in the paper "MILP-Based Automatic Search Algorithms for Differential and Linear Trails for Speck"
The step to generate the LP model:
-
Open the speck_diff_find.py or speck_line_find.py with IDLE(we run the code on Windows and the python version is 3.2.5)
-
Enter F5 to run
-
Input "bar = speck(blocksize); bar.genModel(round)" to get the LP model
-
Use gurobi optimizer to solve the LP model
-
Use get_route_from_sol.sh or get_route_from_sol_1.sh to get the differential path
The example
We input “bar = speck(32); bar.genModel(3)” to get the 3 round speck32’s LP model.
The step to use gurobi to solve the LP model
-
run gurobi
-
Input "m=read("XXX.lp")" to read model
-
Input "m.optimize()" to solve
-
Input "m.write("XXX.sol")" to save the result
References:
Kai fu, Meiqin Wang, Yinghua Guo, Siwei Sun, Lei Hu : MILP-Based Automatic Search Algorithms for Differential and Linear Trails for Speck