This repository contains implementations of Constrained Pseudorandom Functions (CPRFs) for inner product predicates from this paper (to appear at AsiaCrypt 2024). It includes two different constructions: one based on random oracles and another based on the Decisional Diffie-Hellman (DDH) assumption. The implementation can be used to reproduce Tables 2 & 3 from the paper.
Directory | Description |
---|---|
ro-cprf/ | Random oracle based CPRF construction |
ddh-cprf/ | DDH (Naor-Reingold) based CPRF construction |
- Go (version 1.20 or later)
To run benchmarks for each implementation:
-
Choose the implementation you want to benchmark:
- Random Oracle based:
cd ro-cprf
- DDH based:
cd ddh-cprf
- Random Oracle based:
-
Run the benchmarks:
go test -bench=.
The benchmark results are presented in the following format:
BenchmarkEval/length=10-10 555568 2150 ns/op
BenchmarkEval/length=50-10 118142 9941 ns/op
BenchmarkEval/length=100-10 59997 19887 ns/op
BenchmarkEval/length=500-10 12088 97314 ns/op
BenchmarkEval/length=1000-10 5764 196743 ns/op
length=X
: Indicates the vector length used in the CPRF evaluation.-Y
: Indicates number of benchmark iterations.Z ns/op
: Represents the average time in nanoseconds it takes for a single CPRF evaluation operation.
For example, BenchmarkEval/length=100-10 60027 19896 ns/op
means:
- Vector length: 100
- Benchmark iterations: 10
- Average time per evaluation: 19,896 nanoseconds (about 0.02 milliseconds)
- Implement the VDLPN-based construction from the paper.
- Optimize implementations (there's room for performance improvements).
We thank Maxime Bombar for reviewing and providing feedback on the code.
@inproceedings{cprf,
author = {Sacha Servan-Schreiber},
title = {Constrained Pseudorandom Functions for Inner-Product Predicates from Weaker Assumptions},
note = {\url{https://eprint.iacr.org/2024/058}},
url = {https://eprint.iacr.org/2024/058}
editor = {Kai-Min Chung and
Yu Sasaki},
booktitle = {Advances in Cryptology - {ASIACRYPT} 2024 - 30th
International Conference on the Theory and
Application of Cryptology and Information Security,
Kolkata, India, December 9-13, 2024
},
publisher = {Springer},
year = {2024},
}
This implementation is intended for research purposes only. The code has NOT been vetted by security experts. As such, no portion of the code should be used in any real-world or production setting!