International Association for Cryptologic Research

International Association
for Cryptologic Research

Transactions on Symmetric Cryptology, Volume 2025

A New Stand-Alone MAC Construct Called SMAC


README

Tools, demo, and test vectors for SMAC.

Compile

Make sure that you have CMake, clang++, and git available in your environment. Maybe a new version of g++ also works, but I didn't use it. Remember to read the Issues when you start to compile.

git clone https://github.com/jarro2783/cxxopts.git ./src/3rd/cxxopts

git clone https://github.com/google/or-tools.git ./src/3rd/or-tools

mkdir build
cd build
CC=clang CXX=clang++ cmake ..
make mac_universal
make smac_demo

To compile the code for performance, run

cd src
clang++ smac.cpp -o smac_perf -march=native -O3
./smac_perf

In lines 39-41 of smac.cpp, you can uncomment other versions and recompile to test SMAC1, SMAC1x4, and SMAC1x8.
g++ should also work. Also, on my computer, g++ produces a faster executable than clang++.

Run

The help manual of ./build/bin/mac_universal shows everything you need. Examples are as follows.
Please remember that these examples are just examples!
The runtime depends on the hardware and we did not use only 16 threads.
A stronger sigma usually means a longer runtime.
For some cases, we even used 48 threads (and about 48G RAM) on AMD Zen to run for a few days.
However, sometimes we also found that 12 threads was better than 32 threads.
It could be because of the strategy used by OR-Tools.
So, play with your hardware and try more different parameters~

To test t+3 for all sigmas in a file called dataset.txt, run the following command that uses 16 threads, outputs a detailed log, and stops after 57600 seconds or when a trail with 19 active sboxes is found.

mac_universal --file ./dataset.txt --round 3 --thread 16 --threshold 19 -t 57600 -l 1

If you don't specify the threshold and timeout, it will run until the optimal trail is confirmed.

mac_universal --file ./dataset.txt --round 3 --thread 16 -l 1

Note that a special format of the file is required! Otherwise you will get nothing or random stuff. The content of the file should look like the following one where each sigma starts with 'sg={'. This is due to some legacy format at the beginning of our research.

sg={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
sg={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}

To test t+3 for only one sigma, simply replace the --file option with -s like

mac_universal -s 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 --round 3 --thread 16 --threshold 19 -t 57600 -l 1

Dummy clocks are given by the option --dpi=. The value to this option is a list of indices where the constant msg is compressed. For example, to test SMAC-1/2 and t+5, run

mac_universal -s 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 --round 5 --thread 16 --threshold 19 -t 57600 -l 1 --dpi=1,3

which means the clocks 1 and 3 are dummy rounds taking the constant msg.

To run the demo of SMAC, use ./build/bin/smac_demo.

Test vectors

The whole list of test vectors is in test-vectors.txt.

Issues