aboutsummaryrefslogtreecommitdiff
path: root/libbb/crypt_make_salt.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-20 21:28:41 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-20 21:28:41 +0000
commit21d1014b5b91d1a1319273945291b7a9f4717827 (patch)
treeb84eadba35d31f923ef62579652e4e5d76678c38 /libbb/crypt_make_salt.c
parent2f6ae43b9c74d393a139007377895e8c50b8af9a (diff)
downloadbusybox-21d1014b5b91d1a1319273945291b7a9f4717827.tar.gz
chpasswd: new applet by Alexander Shishkin <virtuoso@slind.org>
Diffstat (limited to 'libbb/crypt_make_salt.c')
-rw-r--r--libbb/crypt_make_salt.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libbb/crypt_make_salt.c b/libbb/crypt_make_salt.c
index 12e96328f..ebdf02420 100644
--- a/libbb/crypt_make_salt.c
+++ b/libbb/crypt_make_salt.c
@@ -24,12 +24,9 @@ static int i64c(int i)
return ('a' - 38 + i);
}
-
-void crypt_make_salt(char *p, int cnt)
+int crypt_make_salt(char *p, int cnt, int x)
{
- unsigned x = x; /* it's pointless to initialize it anyway :) */
-
- x += getpid() + time(NULL) + clock();
+ x += getpid() + time(NULL);
do {
/* x = (x*1664525 + 1013904223) % 2^32 generator is lame
* (low-order bit is not "random", etc...),
@@ -44,5 +41,5 @@ void crypt_make_salt(char *p, int cnt)
*p++ = i64c(x >> 22);
} while (--cnt);
*p = '\0';
+ return x;
}
-