summaryrefslogtreecommitdiff
path: root/mkpasswd.c
diff options
context:
space:
mode:
authorMarco d'Itri <md@linux.it>2018-10-14 03:13:07 +0200
committerMarco d'Itri <md@linux.it>2018-10-14 03:19:48 +0200
commit88a7462301b584232937d3210748c1bad6b7ffd2 (patch)
treec0b0673ac83ebc7b5d7216236edfcce3f33d4d38 /mkpasswd.c
parent388d5757c42af3b3a125dc193f5aca92252558a1 (diff)
downloadwhois-88a7462301b584232937d3210748c1bad6b7ffd2.tar.gz
mkpasswd: support the other hash types in libxcrypt
Among them scrypt and bcrypt.
Diffstat (limited to 'mkpasswd.c')
-rw-r--r--mkpasswd.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/mkpasswd.c b/mkpasswd.c
index 78bef2d..b2a4b95 100644
--- a/mkpasswd.c
+++ b/mkpasswd.c
@@ -81,6 +81,13 @@ struct crypt_method {
const char *desc; /* long description for the methods list */
};
+/* XCRYPT_VERSION_NUM is defined in crypt.h from libxcrypt */
+#if defined XCRYPT_VERSION_NUM
+# define HAVE_SHA_CRYPT
+# define HAVE_BCRYPT
+# define HAVE_BSDICRYPT
+#endif
+
static const struct crypt_method methods[] = {
/* method prefix minlen, maxlen rounds description */
#ifdef CRYPT_GENSALT_IMPLEMENTS_DEFAULT_PREFIX
@@ -89,6 +96,10 @@ static const struct crypt_method methods[] = {
/* compatibility aliases for mkpasswd versions < 5.4.0 */
{ "des", "", 2, 2, 0, NULL },
{ "md5", "$1$", 8, 8, 0, NULL },
+#if defined XCRYPT_VERSION_NUM
+ { "yescrypt", "$y$", 0, 0, 0, "Yescrypt" },
+ { "scrypt", "$7$", 0, 0, 0, "scrypt" },
+#endif
#ifdef HAVE_BCRYPT_OBSOLETE
/* http://marc.info/?l=openbsd-misc&m=139320023202696 */
{ "bf", "$2a$", 22, 22, 2, "bcrypt" },
@@ -105,13 +116,17 @@ static const struct crypt_method methods[] = {
{ "sha-256", "$5$", 8, 16, 1, NULL },
{ "sha-512", "$6$", 8, 16, 1, NULL },
#endif
-#if defined __SVR4 && defined __sun
+#if (defined __SVR4 && defined __sun) || defined XCRYPT_VERSION_NUM
{ "sunmd5", "$md5$", 8, 8, 1, "SunMD5" },
#endif
{ "md5crypt", "$1$", 8, 8, 0, "MD5" },
+#ifdef HAVE_BSDICRYPT
+ { "bsdicrypt", "_", 0, 0, 0,
+ N_("BSDI extended DES-based crypt(3)") },
+#endif
{ "descrypt", "", 2, 2, 0,
N_("standard 56 bit DES-based crypt(3)") },
-#if defined FreeBSD
+#if defined FreeBSD || defined XCRYPT_VERSION_NUM
{ "nt", "$3$", 0, 0, 0, "NT-Hash" },
#endif
/* http://www.crypticide.com/dropsafe/article/1389 */