Re: Re: Crypt salts not random.. (fwd)
| From: | Andi Gutmans | Date: | Sun, 29 Apr 2001 21:03:42 +0000 |
| Subject: | Re: Re: Crypt salts not random.. (fwd) | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-52986@lists.php.net to get a copy of this message | ||
At 10:01 PM 4/29/2001 +0200, Jani Taskinen wrote:
On Sun, 29 Apr 2001, Andi Gutmans wrote: At 09:42 PM 4/29/2001 +0200, Jani Taskinen wrote:No reason for it not to have worked. If two threads ran at the same time they would each reinitialize the seed. It's not really a problem. Actually come to think of it we don't need to fix threaded environments :) AndiIt's OK but in multi-threaded mode it should use "(long) tsrm_thread_id()" because getpid() will usually be the same. I hope the case is good enough and will work in all multi-threaded environments. hmm..I wonder. That php_srand() line is the same it was before my patch.. It has had that getpid() in it for a long time. How could it have worked on multi-threaded environments?? Something else is different on those?This is the line in question: php_srand(time(0) * getpid() * (php_combined_lcg() * 10000.0)); This is now (in my patch) in RINIT and thus it is a different pid it doesn't matter if the RINIT happens the same second.. Or did I misunderstood something? And I know it works now. :) And it didn't work before. As the PID was always the same like Andi said. I attached the patch in case you missed it before..