cvs: php4 /ext/standard crypt.c
| From: | Sascha Schumann | Date: | Wed, 26 Jul 2000 16:35:32 +0000 |
| Subject: | cvs: php4 /ext/standard crypt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-942@lists.php.net to get a copy of this message | ||
sas Wed Jul 26 09:35:32 2000 EDT
Modified files:
/php4/ext/standard crypt.c
Log:
Use the lcg as another entropy source for seeding the PRNG when creating
a salt for crypt().
Index: php4/ext/standard/crypt.c
diff -u php4/ext/standard/crypt.c:1.28 php4/ext/standard/crypt.c:1.29
--- php4/ext/standard/crypt.c:1.28 Mon Jun 5 12:47:44 2000
+++ php4/ext/standard/crypt.c Wed Jul 26 09:35:32 2000
@@ -17,7 +17,7 @@
| Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: crypt.c,v 1.28 2000/06/05 19:47:44 andi Exp $ */
+/* $Id: crypt.c,v 1.29 2000/07/26 16:35:32 sas Exp $ */
#include <stdlib.h>
#include "php.h"
@@ -46,6 +46,7 @@
extern char *crypt(char *__key,char *__salt);
#endif
+#include "php_lcg.h"
#include "php_crypt.h"
/*
@@ -150,12 +151,12 @@
/* 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