From: Andrew Garrett Date: Fri, 11 Apr 2008 00:43:13 +0000 (+0000) Subject: Add wfGenerateToken function, to generate a random hex token. Used in CentralAuth... X-Git-Tag: 1.31.0-rc.0~48453 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=4f61581a9091237b8600d22e471480e51853c3e4;p=lhc%2Fweb%2Fwiklou.git Add wfGenerateToken function, to generate a random hex token. Used in CentralAuth, currently. --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index f28d7cf9ea..51d0749f0a 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2502,3 +2502,12 @@ function wfWaitForSlaves( $maxLag ) { } } } + +/** Generate a random 32-character hexadecimal token. + * @param mixed $salt Some sort of salt, if necessary, to add to random characters before hashing. + */ + function wfGenerateToken( $salt = '' ) { + $salt = serialize($salt); + + return md5( mt_rand( 0, 0x7fffffff ) . $salt ); + } \ No newline at end of file