Digestif - Hash algorithms in C and OCaml
Digestif is a toolbox which implements hashes:
Digestif uses a trick about linking and let the end-user to choose which implementation he wants to use. We provide 2 implementations:
- C implementation with
- OCaml implementation with
Both are well-tested. However, OCaml implementation is slower than the C implementation.
Home page: http://din.osau.re/
Contact: Romain Calascibetta
For each hash, we implement the same API which is referentially transparent.
Then, on the top of these, we reflect functions (like
GADT - however, conversion from GADT to hash type is not possible (but you can
destruct GADT with
We deciced to protect users to timing-attack. In this case,
eqaf package) compares hashes in
However, we provide
unsafe_compare function too which is not a constant
time function. In some contexts, like
ocaml-git, we don't care about timing
attack and we use
unsafe_compare - then, we need to make a wrap where we
compare to be able to use it in some functors like
It's little annoying to do that but it forces the user to get the right question about security issues. So, please, don't ask to rename this function.
Of course, this package is available to be used on MirageOS (both
implementations). User is able to compile
and this package is platform agnostic.
- OCaml >= 4.03.0 (may be less but need test)
duneto build the project
If you want to compile the test program, you need:
All credits appear in the begin of files and this library is motivated by two reasons:
- delete the dependancy with
nocryptoif you don't use the encryption (and common) part
- aggregate all hashes functions in one library