Revision: 50176
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 14, 2011 00:59 by karmacode
Initial Code
// for mysql password
function mysql_password($password)
{
$nr = 1345345333;
$add = 7;
$nr2 = 0x12345671;
for ($i = 0; $i < strlen($password); $i++)
{
if ($password[$i] == ' ' || $password[$i] == '\t')
continue;
$tmp = ord($password[$i]);
$nr ^= (($nr & 63)+$add)*$tmp + ($nr << 8);
$nr2 += ($nr2 << 8) ^ $nr;
$add += $tmp;
}
$h1 = $nr & (1<<31) - 1;
$h2 = $nr2 & (1<<31) - 1;
return sprintf("%08lx%08lx", $h1, $h2);
}
Initial URL
http://www.php-forum.com/phpforum/viewtopic.php?f=2&t=169
Initial Description
Initial Title
PHP equivalent of MySQL password()
Initial Tags
mysql, php
Initial Language
PHP