From 88bf5a8a8d7d796f63cca8589f4de67aa8345f1a Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 29 Aug 2012 12:41:29 -0400 Subject: add sha256/sha512 crypt based on versions sent to the list by nsz, with some simplification and debloating. i'd still like to get them a bit smaller, or ideally merge them into a single file with most of the code being shared, but that can be done later. --- src/misc/crypt_r.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/misc/crypt_r.c') diff --git a/src/misc/crypt_r.c b/src/misc/crypt_r.c index f4716d6f..1c7f9cf0 100644 --- a/src/misc/crypt_r.c +++ b/src/misc/crypt_r.c @@ -6,6 +6,8 @@ struct crypt_data; char *__crypt_des(const char *, const char *, char *); char *__crypt_md5(const char *, const char *, char *); char *__crypt_blowfish(const char *, const char *, char *); +char *__crypt_sha256(const char *, const char *, char *); +char *__crypt_sha512(const char *, const char *, char *); char *__crypt_r(const char *key, const char *salt, struct crypt_data *data) { @@ -17,6 +19,10 @@ char *__crypt_r(const char *key, const char *salt, struct crypt_data *data) #endif if (salt[1] == '2' && salt[3] == '$') return __crypt_blowfish(key, salt, output); + if (salt[1] == '5' && salt[2] == '$') + return __crypt_sha256(key, salt, output); + if (salt[1] == '6' && salt[2] == '$') + return __crypt_sha512(key, salt, output); } return __crypt_des(key, salt, output); } -- cgit v1.2.1