diff options
author | foobar <sniper@php.net> | 2001-09-05 19:47:55 +0000 |
---|---|---|
committer | foobar <sniper@php.net> | 2001-09-05 19:47:55 +0000 |
commit | 42b5521af505eaddfd4891703da8120865896258 (patch) | |
tree | c80bb41e38dba221361ce7eb504f28eb557014bd /ext/standard/crypt.c | |
parent | 24b54b866fc36fed094c1f455e0174c99c24ee40 (diff) | |
download | php-git-42b5521af505eaddfd4891703da8120865896258.tar.gz |
revert bad commit.
Diffstat (limited to 'ext/standard/crypt.c')
-rw-r--r-- | ext/standard/crypt.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index bdd085b5d3..00490f78e4 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -89,6 +89,8 @@ extern char *crypt(char *__key, char *__salt); #define PHP_CRYPT_RAND php_rand() +static int php_crypt_rand_seeded=0; + PHP_MINIT_FUNCTION(crypt) { REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); @@ -101,6 +103,16 @@ PHP_MINIT_FUNCTION(crypt) } +PHP_RINIT_FUNCTION(crypt) +{ + if(!php_crypt_rand_seeded) { + php_srand(time(0) * getpid() * (php_combined_lcg(TSRMLS_C) * 10000.0)); + php_crypt_rand_seeded=1; + } + return SUCCESS; +} + + static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; static void php_to64(char *s, long v, int n) { |