Skip to content

Latest commit

 

History

History
79 lines (53 loc) · 4.51 KB

File metadata and controls

79 lines (53 loc) · 4.51 KB

Secure computing: computing on encrypted or private data

This is the companion OCaml code for Xavier Leroy's 2025 course at Collège de France, Secure computing: computing on encrypted or private data.

Libraries

Demos

  • Yao's millionaire problem: compare two secret integers

  • Counting electronic votes

    • without protection against ballot stuffing: Vote1 [uses Paillier]
    • using ZKP to prove that ballots are not stuffed: Vote2 [uses ElGamal, SigmaZKP]
  • Private Set Intersection

    • see which poets you have in common with the server: Poets [uses PSI, Paillier]
  • Threshold decryption

    • sharing a private key between three shareholders; any two can decrypt: Threshold [uses Replicated23, ElGamal]
  • Oblivious RAM

    • crude visualization of ORAM (absence of) memory access patterns: ObliviousRAM [uses ORAM]

Building and running demos

  • Installing dependencies: opam install --deps-only . (watch the final dot!)
  • Building: make all
  • Running a demo: ./<demo-name>.exe. This will print instructions on how to run the demo.

Disclaimer

This code is provided for learning purposes only and should not be used in any high-security application. It contains many insecurities such as keys too small (SHE), insufficient randomness (GarbledCircuits), insecure messaging (MultiParty), naive protocols (Vote2), and timing leaks (everywhere).

Licensing

All files copyright 2026 Xavier Leroy.

The files in lib/ are distributed under the terms of the GNU Lesser General Public License version 2.1 (LGPL 2.1) or, at your option, any later version of the LGPL, with the OCaml LGPL linking exception.

All other files are distributed under the terms of the GNU General Public License version 2 (GPL 2) or, at your option, any later version of the GPL.