jedisct1 / libhydrogen

A lightweight, secure, easy-to-use crypto library suitable for constrained environments.
https://libhydrogen.org
Other
605 stars 90 forks source link

What does hydro_hash_hash return, and under what conditions? #124

Closed kozross closed 2 years ago

kozross commented 2 years ago

Based on the documentation here, hydro_hash_hash returns an int. However, it is not specified what this int will be, and under what conditions. Is this specified somewhere?

jedisct1 commented 2 years ago

It returns -1 on error, 0 on success.

An error will happen if the returned size is not between hydro_hash_BYTES_MIN and hydro_hash_BYTES_MAX.

kozross commented 2 years ago

Thanks! What about all the other int-returning functions dealing with generic hashing? Is it the same kind of idea?

jedisct1 commented 2 years ago

0 means that everything's fine and -1 that something went wrong :) Same convention everywhere, just like the C standard library.