International Association for Cryptologic Research

International Association
for Cryptologic Research

Transactions on Symmetric Cryptology, Volume 2025

MDS Diffusion Layers for Arithmetization-Oriented Symmetric Ciphers: The Rotational-Add Construction


README

RotAdd_MDS_diffusion_layers

Codes for the paper "MDS Diffusion Layers for Arithmetization-Oriented Symmetric Ciphers: The Rotational-Add Construction" (ToSC 2025 issue 3).

Clone the repository by

git clone --recurse-submodules https://github.com/ba0fengwu/rotadd_mds_diffusion_layers.git

1. Analyse properties of rotational-add diffusion layers and construct explicit class of MDS ones

The directory rotadd_diff_layer/ contains:

$ cd rotadd_diff_layer
$ sage search_light_mds_L4m.sage # Generate all MDS L4m with rotation offsets of weight 5 with multiple values of m, and record the results in separate `.txt` files. Among them, `light_mds_L4m_m4.txt` and `light_mds_L4m_m8.txt` correspond to Table 3 and Table 4 in Append. A of the paper, respectively.
$ sage construct_light_mds_L4m.sage # Generate Table 5, Table 6 and Table 7 in Append. B of the paper.
$ sage inverse_light_mds_L4m.sage # Generate inverses of MDS constructions in Append. B, which are supplementary results not included in the paper.

All results will be saved to the rotadd_diff_layer/results directory. Note that some result files contain very broad tables. Please
"disable word wrap" in your text editor to view it properly.


2. Test efficiency of YuX_dag and YuX

The directory Yux_dag_efficiency_test contains:

To perform the test, you should install the homomomorphic encryption library HElib first. Follow the instructions in https://github.com/homenc/HElib/blob/master/INSTALL.md to install it and we suggest the library build method (Option 1).

$ git clone https://github.com/homenc/HElib.git
$ cd HElib
$ mkdir build
$ cd build
$ cmake -DPACKAGE_BUILD=ON ..
$ make -j$(nproc)
$ sudo make install

For a root user, the default path of HElib is /usr/local/helib_pack/. If HElib is installed in another path, you should modify the path in target_include_directories() in Yux_FHE_HElib/CMakeLists.txt to your path of HElib before compiling.

After installing HElib, you can build YuX_dag and YuX by

$ cd Yux_dag_efficiency_test/Yux_FHE_HElib
$ git checkout main
$ mkdir build
$ cd build
$ cmake .. # if HElib is not installed in the default path, use "cmake -DCMAKE_PREFIX_PATH=/your_path/helib_install .." instead
$ make

Then go back to the directory Yux_dag_efficiency_test and run the bash script run_with_logging.sh to perform the test. The results will be outputted to Yux_dag_efficiency_test/logs/.

Note on Test Duration:
Testing the plain implementation of the encryption algorithm (1,000 iterations) is extremely fast, completing in milliseconds. In contrast, testing the homomorphic implementation of the decryption algorithm (100 iterations) is time-consuming, taking approximately 2, 6 and 9 hours for 9, 12 and 14 rounds, respectively.

(1)

$ ./run_with_logging.sh tests/test-blockcipher-F_p
$ ./run_with_logging.sh tests/test-blockcipher-dagger-F_p

This can generate (*** represents the timestamp):

(2)

$ ./run_with_logging.sh tests/test-transciphering-F_p-16
$ ./run_with_logging.sh tests/test-transciphering-dagger-F_p-16

This can generate (*** represents the timestamp):

(3) Change the pROUND parameter to 12 in the file Yux_FHE_HElib/transciphering/param.h by replacing static long pROUND = 9 to static long pROUND = 12,and rebuild the project. Then run

$ ./run_with_logging.sh tests/test-transciphering-F_p-16
$ ./run_with_logging.sh tests/test-transciphering-dagger-F_p-16

This can generate (*** represents the timestamp):

(4) Change the pROUND parameter to 14 in the file Yux_FHE_HElib/transciphering/param.h by replacing static long pROUND = 9 to static long pROUND = 14,and rebuild the project. Then run

$ ./run_with_logging.sh tests/test-transciphering-F_p-16
$ ./run_with_logging.sh tests/test-transciphering-dagger-F_p-16

This can generate (*** represents the timestamp):