2016-08-01 15:33:32 +00:00
|
|
|
#ifndef MH_HULTIHASH_H
|
|
|
|
#define MH_HULTIHASH_H
|
|
|
|
|
2016-08-10 13:46:15 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2016-08-01 15:33:32 +00:00
|
|
|
// returns hash code or error (which is < 0)
|
2016-08-10 13:46:15 +00:00
|
|
|
int mh_multihash_hash(const unsigned char *multihash, size_t len);
|
2016-08-01 15:33:32 +00:00
|
|
|
|
|
|
|
// returns length of multihash or error (which is < 0)
|
2016-08-10 13:46:15 +00:00
|
|
|
int mh_multihash_length(const unsigned char *multihash, size_t len);
|
|
|
|
|
2016-08-15 16:46:39 +00:00
|
|
|
// gives access to raw digest inside multihash buffer
|
2016-08-10 13:46:15 +00:00
|
|
|
// returns 0 or negative error
|
2016-10-23 15:28:49 +00:00
|
|
|
int mh_multihash_digest(unsigned char *multihash, size_t len,
|
|
|
|
unsigned char **digest, size_t *digest_len);
|
2016-08-10 13:46:15 +00:00
|
|
|
|
|
|
|
// returns length in bytes of buffer needed to store multihash
|
2016-08-15 16:46:39 +00:00
|
|
|
// with given hashcode and with given digest length
|
2016-08-10 13:46:15 +00:00
|
|
|
// returns length or negative error code
|
2016-08-15 16:46:39 +00:00
|
|
|
int mh_new_length(int code, size_t digest_len);
|
2016-08-10 13:46:15 +00:00
|
|
|
|
|
|
|
// writes multihash into a buffer, the buffer needs to be at least
|
|
|
|
// mh_new_length() bytes long.
|
|
|
|
// returns negative error code or 0
|
2016-08-15 16:46:39 +00:00
|
|
|
int mh_new(unsigned char *buffer, int code, const unsigned char *digest,
|
|
|
|
size_t digest_len);
|
2016-08-01 15:33:32 +00:00
|
|
|
|
|
|
|
#endif /* end of include guard */
|