diff options
author | Sascha Schumann <sas@php.net> | 2000-07-26 16:35:32 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2000-07-26 16:35:32 +0000 |
commit | 30472a1cc1a0125bb5006863f8e28bbc573d152b (patch) | |
tree | 58d03a7247cf386f81260aa3e901d4647dfe7969 /ext/standard/crypt.c | |
parent | 2c420944941cf6d7261b99af157a186217c6f2c8 (diff) | |
download | php-git-30472a1cc1a0125bb5006863f8e28bbc573d152b.tar.gz |
Use the lcg as another entropy source for seeding the PRNG when creating
a salt for crypt().
Diffstat (limited to 'ext/standard/crypt.c')
-rw-r--r-- | ext/standard/crypt.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index c422e42efd..7ede808501 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -46,6 +46,7 @@ extern char *crypt(char *__key,char *__salt); #endif +#include "php_lcg.h" #include "php_crypt.h" /* @@ -150,12 +151,12 @@ PHP_FUNCTION(crypt) /* The automatic salt generation only covers standard DES and md5-crypt */ if(!*salt) { #if HAVE_SRAND48 - srand48((unsigned int) time(0) * getpid()); + srand48((unsigned int) time(0) * getpid() * (php_combined_lcg() * 10000.0)); #else #if HAVE_SRANDOM - srandom((unsigned int) time(0) * getpid()); + srandom((unsigned int) time(0) * getpid() * (php_combined_lcg() * 10000.0)); #else - srand((unsigned int) time(0) * getpid()); + srand((unsigned int) time(0) * getpid() * (php_combined_lcg() * 10000.0)); #endif #endif |