diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-11-10 18:52:35 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-11-10 18:52:35 +0000 |
commit | 2211d5268cc6fc5575f758a9835070fae5ffc405 (patch) | |
tree | 46b23253b2be2c2c5bcdb6909a740e894a93ae07 /libbb/pw_encrypt_md5.c | |
parent | 56dceb9b7722193ef53fb1afb981f1289eecb0b0 (diff) | |
download | busybox-w32-2211d5268cc6fc5575f758a9835070fae5ffc405.tar.gz busybox-w32-2211d5268cc6fc5575f758a9835070fae5ffc405.tar.bz2 busybox-w32-2211d5268cc6fc5575f758a9835070fae5ffc405.zip |
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
Diffstat (limited to 'libbb/pw_encrypt_md5.c')
-rw-r--r-- | libbb/pw_encrypt_md5.c | 14 |
1 files changed, 2 insertions, 12 deletions
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]) | |||
494 | } | 494 | } |
495 | 495 | ||
496 | 496 | ||
497 | static char* | ||
498 | __md5_to64(char *s, unsigned v, int n) | ||
499 | { | ||
500 | while (--n >= 0) { | ||
501 | *s++ = ascii64[v & 0x3f]; | ||
502 | v >>= 6; | ||
503 | } | ||
504 | return s; | ||
505 | } | ||
506 | |||
507 | /* | 497 | /* |
508 | * UNIX password | 498 | * UNIX password |
509 | * | 499 | * |
@@ -605,9 +595,9 @@ md5_crypt(char passwd[MD5_OUT_BUFSIZE], const unsigned char *pw, const unsigned | |||
605 | final[16] = final[5]; | 595 | final[16] = final[5]; |
606 | for (i = 0; i < 5; i++) { | 596 | for (i = 0; i < 5; i++) { |
607 | unsigned l = (final[i] << 16) | (final[i+6] << 8) | final[i+12]; | 597 | unsigned l = (final[i] << 16) | (final[i+6] << 8) | final[i+12]; |
608 | p = __md5_to64(p, l, 4); | 598 | p = to64(p, l, 4); |
609 | } | 599 | } |
610 | p = __md5_to64(p, final[11], 2); | 600 | p = to64(p, final[11], 2); |
611 | *p = '\0'; | 601 | *p = '\0'; |
612 | 602 | ||
613 | /* Don't leave anything around in vm they could use. */ | 603 | /* Don't leave anything around in vm they could use. */ |