1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
14 char *pw_encrypt(const char *clear, const char *salt)
16 static char cipher[128];
19 #if 0 /* was CONFIG_FEATURE_SHA1_PASSWORDS, but there is no such thing??? */
20 if (strncmp(salt, "$2$", 3) == 0) {
21 return sha1_crypt(clear);
24 cp = (char *) crypt(clear, salt);
25 /* if crypt (a nonstandard crypt) returns a string too large,
26 truncate it so we don't overrun buffers and hope there is
27 enough security in what's left */
28 safe_strncpy(cipher, cp, sizeof(cipher));