summaryrefslogtreecommitdiffhomepage
path: root/loginutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-15 08:12:00 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-15 08:12:00 +0000
commit04087c6bbd247ef5802de3f8bd625fa3643e23e2 (patch)
treeced2e67083fca4ea67714988f63f6ad6dd99a07b /loginutils
parentd50dda8c3501af9d593cd11272a15b480864a01c (diff)
cryptpw: fix "cryptpw -a des -- TEXT" case
libbb/pw_encrypt_des.c: optimize function old new delta cryptpw_main 177 157 -20 des_crypt 1682 1512 -170 pw_encrypt 1036 842 -194 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-384) Total: -384 bytes Run tested.
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/cryptpw.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c
index 1acbc6db0..901f6fcde 100644
--- a/loginutils/cryptpw.c
+++ b/loginutils/cryptpw.c
@@ -15,14 +15,14 @@ if you played with bbox's crypt implementation.
while read line; do
n=`./busybox cryptpw -a des -- "$line"`
- o=`./busybox_old cryptpw -a des -- "$line"`
+ o=`./busybox_org cryptpw -a des -- "$line"`
test "$n" != "$o" && {
echo n="$n"
echo o="$o"
exit
}
n=`./busybox cryptpw -- "$line"`
- o=`./busybox_old cryptpw -- "$line"`
+ o=`./busybox_org cryptpw -- "$line"`
test "$n" != "$o" && {
echo n="$n"
echo o="$o"
@@ -35,12 +35,12 @@ int cryptpw_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int cryptpw_main(int argc ATTRIBUTE_UNUSED, char **argv)
{
char salt[sizeof("$N$XXXXXXXX")];
+ char *opt_a;
- if (!getopt32(argv, "a:", NULL) || argv[optind - 1][0] != 'd') {
- strcpy(salt, "$1$");
- /* Too ugly, and needs even more magic to handle endianness: */
- //((uint32_t*)&salt)[0] = '$' + '1'*0x100 + '$'*0x10000;
- /* Hope one day gcc will do it itself (inlining strcpy) */
+ if (!getopt32(argv, "a:", &opt_a) || opt_a[0] != 'd') {
+ salt[0] = '$';
+ salt[1] = '1';
+ salt[2] = '$';
crypt_make_salt(salt + 3, 4, 0); /* md5 */
#if TESTING
strcpy(salt + 3, "ajg./bcf");