Refactor hashing API
It would be useful for the hashing API in crypto.c to have consistent success/error retvals.
For example, some functions return 1 on error, when instead these should return negative values for errors. See crypto_digest256 for example.