aboutsummaryrefslogblamecommitdiffstats
path: root/libar2simplified_encode_hash.c
blob: da80ff6f98af83906a25b09811573404b6d8119d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}