diff options
Diffstat (limited to 'libar2simplified_encode_hash.c')
-rw-r--r-- | libar2simplified_encode_hash.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libar2simplified_encode_hash.c b/libar2simplified_encode_hash.c new file mode 100644 index 0000000..da80ff6 --- /dev/null +++ b/libar2simplified_encode_hash.c @@ -0,0 +1,17 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +char * +libar2simplified_encode_hash(const struct libar2_argon2_parameters *params, void *hash) +{ + size_t size = libar2_encode_base64(NULL, hash, params->hashlen); + char *ret = malloc(size); + if (!ret) { + errno = ENOMEM; + return NULL; + } + if (libar2_encode_base64(ret, hash, params->hashlen) != size) + abort(); + return ret; +} |