diff options
-rw-r--r-- | loginutils/passwd.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index a062596b4..c28e9b80e 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c | |||
@@ -34,10 +34,15 @@ static void crypt_make_salt(char *p, int cnt) | |||
34 | 34 | ||
35 | x += getpid() + time(NULL) + clock(); | 35 | x += getpid() + time(NULL) + clock(); |
36 | do { | 36 | do { |
37 | /* x = (x*1664525 + 1013904223) mod 2^32 generator is lame | 37 | /* x = (x*1664525 + 1013904223) % 2^32 generator is lame |
38 | * (low-order bit is not "random", etc...), | 38 | * (low-order bit is not "random", etc...), |
39 | * but for our purposes it is good enough */ | 39 | * but for our purposes it is good enough */ |
40 | x = x*1664525 + 1013904223; | 40 | x = x*1664525 + 1013904223; |
41 | /* BTW, Park and Miller's "minimal standard generator" is | ||
42 | * x = x*16807 % ((2^31)-1) | ||
43 | * It has no problem with visibly alternating lowest bit | ||
44 | * but is also weak in cryptographic sense + needs div, | ||
45 | * which needs more code (and slower) on many CPUs */ | ||
41 | *p++ = i64c(x >> 16); | 46 | *p++ = i64c(x >> 16); |
42 | *p++ = i64c(x >> 22); | 47 | *p++ = i64c(x >> 22); |
43 | } while (--cnt); | 48 | } while (--cnt); |