blob: 50bd06418959c407fb80f9c43e32dd10b7bc726f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/*
* Utility routines.
*
* Copyright (C) 2025 by Denys Vlasenko <vda.linux@googlemail.com>
*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
#include "yescrypt/alg-yescrypt.h"
static char *
yes_crypt(const char *passwd, const char *salt_data)
{
/* prefix, '$', hash, NUL */
char buf[YESCRYPT_PREFIX_LEN + 1 + YESCRYPT_HASH_LEN + 1];
char *retval;
retval = yescrypt_r(
(const uint8_t *)passwd, strlen(passwd),
(const uint8_t *)salt_data,
buf, sizeof(buf));
/* The returned value is either buf[], or NULL on error */
return xstrdup(retval);
}
|