bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainenconst struct hash_method *hash_method_lookup(const char *name)
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen unsigned int i;
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainenstatic void hash_method_init_size(void *context)
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainenhash_method_loop_size(void *context, const void *data ATTR_UNUSED, size_t size)
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainenstatic void hash_method_result_size(void *context, unsigned char *result_r)
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen result_r[0] = (*ctx & 0xff00000000000000ULL) >> 56;
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen result_r[1] = (*ctx & 0x00ff000000000000ULL) >> 48;
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen result_r[2] = (*ctx & 0x0000ff0000000000ULL) >> 40;
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen result_r[3] = (*ctx & 0x000000ff00000000ULL) >> 32;
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen result_r[4] = (*ctx & 0x00000000ff000000ULL) >> 24;
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen result_r[5] = (*ctx & 0x0000000000ff0000ULL) >> 16;
74ae32512357bdd4872bf160dc697ff7b54b54c5Timo Sirainen result_r[6] = (*ctx & 0x000000000000ff00ULL) >> 8;
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomibuffer_t *t_hash_data(const struct hash_method *meth,
c147bff818798a979d93537f72f5c1f68f5d5ba8Aki Tuomi buffer_t *result = t_buffer_create(meth->digest_size);
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomi unsigned char *resptr = buffer_append_space_unsafe(result,
ba706bd508fdbe3e6c971769d0c913b32bf458ebAki Tuomi meth->loop(ctx, data == NULL ? "" : data, data_len);
0b3e92b6043435c5aa9f1cf1d04b632f3e19abd9Phil Carmodystatic const struct hash_method hash_method_size = {