74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen /* Number of bytes that must be allocated for context */
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen /* Number of bytes that must be allocated for result()'s digest */
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen void (*loop)(void *context, const void *data, size_t size);
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen void (*result)(void *context, unsigned char *digest_r);
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainenconst struct hash_method *hash_method_lookup(const char *name);
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen/* NULL-terminated list of all hash methods */
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainenextern const struct hash_method *hash_methods[];
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomi/** Simple helpers for digesting (hashing)
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomi buffer_t *result = t_hash_str(hash_method_lookup("sha256"), "hello world");
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomi const char *hex = binary_to_hex(result->data, result->used);
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomibuffer_t *t_hash_data(const struct hash_method *meth,
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomistatic inline
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomibuffer_t *t_hash_buffer(const struct hash_method *meth,
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomistatic inline
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomibuffer_t *t_hash_str(const struct hash_method *meth,
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomi const char *data)