This Lua script analyzes Boolean functions defined in hexadecimal format for their t-th order correlation immunity. Two algorithms are supported:
- Naive (
-n) - Optimized (
-o)
lua analyzer.lua <hex-binary-function> <correlation-order> [-n | -o]<hex-binary-function>: Hexadecimal representation of the Boolean function's output.<correlation-order>: The ordertfor correlation immunity.-n: Use the naive algorithm.-o: Use the optimized algorithm.
lua analyzer.lua 0xB4 1 -n
lua analyzer.lua 0xDB011464C2F090B41B597D60DD256EE2 2 -o| Name | Hexadecimal Function |
|---|---|
| groundT | 0xB4 |
| 7-bit | 0xDB011464C2F090B41B597D60DD256EE2 |
| 8-bit | 0xDB011464C2F090B41B597D60DD256EE224FEEB9B3D0F6F4BE4A6829F22DA911D |
| 9-bit | Concatenation of 7-bit and 8-bit values |
The analyzer reports:
- Whether the function is balanced (equal number of 0s and 1s).
- Whether it is immune to t-th order correlation.
- Which algorithm was used.
The script also includes:
- Hamming weight and Walsh transform utilities.
- A simple Fermat primality test, included for experimentation.
This analyzer is a practical tool for testing correlation properties of Boolean functions in cryptographic contexts, such as S-box analysis or stream cipher component validation.