Skip to content

OCaml Public Key Cryptography Implementation (with proofs in French)

Notifications You must be signed in to change notification settings

ghuysmans/toy-crypto

Repository files navigation

Toy Asymmetric Cryptography

This is a simple (and insecure) implementation of RSA and Diffie-Hellman. Most algorithms are proven (in French) in a LaTeX document.

Implementation

The Numbers.Make functor allows using any Concrete number representation:

  • Int (31- or 63-bit OCaml integer, nice for testing purpose)
  • Bigint (values are tagged, not directly saved as strings)

Phantom types allow statically differentiating public and private keys.

Structure

  • numbers.ml, rsa.ml, and diffie_hellman.ml contain the library
  • toy.ml is a simple CLI tool
  • rsa.tex contains proofs in French

How to build

make toy.byte