Modify FastCGI server to use MySQL for auth
[matches/MCTX3420.git] / testing / MCTXWeb / public_html / users / models / funcs.php
index 021f3a0..07af426 100644 (file)
@@ -71,14 +71,13 @@ function generateHash($plainText, $salt = null)
 {\r
        if ($salt === null)\r
        {\r
-               $salt = substr(md5(uniqid(rand(), true)), 0, 25);\r
+               //$salt = substr(md5(uniqid(rand(), true)), 0, 25); // Original UserCake\r
+               $random = file_get_contents("/dev/urandom", false, null, 0, 25); // Get random number\r
+               $salt = '$6$'.bin2hex($random).'$'; // Make hex salt\r
+               \r
        }\r
-       else\r
-       {\r
-               $salt = substr($salt, 0, 25);\r
-       }\r
-       \r
-       return $salt . sha1($salt . $plainText);\r
+       //return $salt . sha1($salt . $plainText); // Original UserCake\r
+       return crypt($plainText, $salt);\r
 }\r
 \r
 //Checks if an email is valid\r

UCC git Repository :: git.ucc.asn.au