mirage / digestif

Simple hash algorithms in OCaml
MIT License
87 stars 26 forks source link

lack of documentation #139

Closed mimoo closed 1 year ago

mimoo commented 2 years ago

just a general comment, but I'm trying to understand some code making use of this library and there's code like

  let h = Digestif.blake2s 32 in

and there doesn't seem to be any official documentation anywhere I can find on what 32 is here.

(The doc is here: https://ocaml.org/p/digestif/0.9.0/doc/Digestif/index.html#val-blake2s but there is no actual documentation)

dinosaure commented 2 years ago

Yes. this is the length (digest_size) of the BLAKE2B hash. You can decide the length of the BLAKE2{B,S} hash and it will be a part of the initial IV used. And, indeed, you are right, we should document it :+1:. I will try to spend sometimes on that. Thanks!

dinosaure commented 1 year ago

I try to figure out how to complete the documentation but since #103, I arbitrary did the choice to delete this argument (which can be error-prone and generate segfaults with the C backend). This change was done 2 years ago (August 2020) and you are probably stuck on a old version of digestif (0.9.0).

If you need to generate a BLAKE2{B,S} with a specific size, I can re-introduce something which can help you to do so. In that case, please fill a new issue. I can close this issue which is not related to the upstream version of digestif. Thanks for your patience.