diff options
author | Mattias Andrée <maandree@kth.se> | 2022-02-13 00:28:37 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-02-13 00:28:37 +0100 |
commit | 2ef79ab9d01090c1b3a2cc445a18d141cbb3c781 (patch) | |
tree | 1a455cc6d734f4b63adaf7857e4747dd2ed8ffcb /libar2simplified_encode_hash.c | |
download | libar2simplified-2ef79ab9d01090c1b3a2cc445a18d141cbb3c781.tar.gz libar2simplified-2ef79ab9d01090c1b3a2cc445a18d141cbb3c781.tar.bz2 libar2simplified-2ef79ab9d01090c1b3a2cc445a18d141cbb3c781.tar.xz |
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
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; +} |