From 2211d5268cc6fc5575f758a9835070fae5ffc405 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 10 Nov 2008 18:52:35 +0000 Subject: libbb: add optionl support for SHA256/512 encrypted passwords function old new delta sha_crypt - 2423 +2423 cryptpw_main 128 183 +55 to64 - 29 +29 pw_encrypt 974 1000 +26 str_rounds - 11 +11 login_main 1532 1541 +9 packed_usage 25215 25200 -15 __md5_to64 29 - -29 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 3/1 up/down: 2553/-44) Total: 2509 bytes --- libbb/pw_encrypt_md5.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'libbb/pw_encrypt_md5.c') diff --git a/libbb/pw_encrypt_md5.c b/libbb/pw_encrypt_md5.c index 8d0a516cf..b7478aa9d 100644 --- a/libbb/pw_encrypt_md5.c +++ b/libbb/pw_encrypt_md5.c @@ -494,16 +494,6 @@ static void __md5_Transform(uint32_t state[4], const unsigned char block[64]) } -static char* -__md5_to64(char *s, unsigned v, int n) -{ - while (--n >= 0) { - *s++ = ascii64[v & 0x3f]; - v >>= 6; - } - return s; -} - /* * UNIX password * @@ -605,9 +595,9 @@ md5_crypt(char passwd[MD5_OUT_BUFSIZE], const unsigned char *pw, const unsigned final[16] = final[5]; for (i = 0; i < 5; i++) { unsigned l = (final[i] << 16) | (final[i+6] << 8) | final[i+12]; - p = __md5_to64(p, l, 4); + p = to64(p, l, 4); } - p = __md5_to64(p, final[11], 2); + p = to64(p, final[11], 2); *p = '\0'; /* Don't leave anything around in vm they could use. */ -- cgit v1.2.3