Implementation of Diamond iO, a straightforward construction of indistinguishability obfuscation (iO).
- Rust 1.87 nightly
- OpenFHE (System install required in
/usr/local/lib
), make sure to install our fork in/feat/improve_determinant
branch
You can run evaluation experiments with e2e parameters with dio cli tooling.
After installing the prerequisites, you can build the project using:
cargo build --release
- Dummy parameters
Fastest way to check if the end-to-end process works with insecure parameters:
cargo test -r --test test_io_dummy_param --no-default-features -- --nocapture
- Real parameters Warning: You need sufficient RAM.
cargo test -r --test test_io_real_param --no-default-features -- --ignored --nocapture
- With memory profiler
uv run memory_profile.py cargo test -r --test test_io_dummy_param --no-default-features
We currently support two different matrix implementations:
- In-memory (default): Uses memory for all matrix storage.
- Disk-backed (enable with
--features disk
): Uses themmap()
syscall to store matrices on disk.
Our simulator only targets circuits used for our benchmarks.
- Make sure to install
dio
binary before - Change the following values hardcoded in
simulator/main.py
after the lineif __name__ == "__main__":
:secpar
: the minimum security parameter you want to guarantee.log2_n
: a log2 value of the ring dimension.max_d
: the maximum value of the number of the secret polynomials denoted byd
.min_base_bits
: the minimum value of the base bits for decomposition denoted bybase_bits
.max_base_bits
: the maximum value ofbase_bits
.crt_bits
: the bits of each moduli of CRT.max_crt_depth
: the maximum number of moduli.input_size
: the evaluator's input bit size.input_width
: the number of bits inserted at each diamond. The larger value ofinput_width
increase the number of preimages but decrease the required modulus size.add_num
: the number of addition gates for the evaluator's input bits.mul_num
: the number of multiplication gates for the evaluator's input bits.
- Install sagemath if you have not installed it. Ref: https://doc.sagemath.org/html/en/installation/conda.html
- Run
sage main.py
under thesimulator
directory.
If the script is completed without any error, the found parameters are added to the last line in simulator/params.log
.
Among the parameters, crt_depth
denotes the minimum number of moduli satisfying correctness and security, and d
, hardcoded_key_sigma
, p_sigma
, and switched_modulus
can be used for ObfuscationParams
.
We would like to sincerely thank the developers of OpenFHE and openfhe-rs, open-source lattice and FHE libraries, whose optimized implementations of trapdoor sampling, RLWE primitives, and Rust bindings played a crucial role in helping us implement Diamond iO. We are also grateful to Prof. Yuriy Polyakov for his valuable advice on preimage sampling and his insightful feedback on optimizing our implementation. We greatefully acknowledge Community Privacy Residency (2025), in which our earliest implementation was developed. Any remaining errors are entirely our own responsibility.