Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: seven minus five?
(Example: nine)

The Note You're Voting On

php at wbhostmax dot de
12 years ago
<?php
function DoubleSaltedHash($pw, $salt) {
return
sha1($salt.sha1($salt.sha1($pw)));
}

function
generate_salt() {
$dummy = array_merge(range('0', '9'));
mt_srand((double)microtime()*1000000);
for (
$i = 1; $i <= (count($dummy)*2); $i++)
{
$swap = mt_rand(0,count($dummy)-1);
$tmp = $dummy[$swap];
$dummy[$swap] = $dummy[0];
$dummy[0] = $tmp;
}
return
sha1(substr(implode('',$dummy),0,9));
}
$pw="geheim"
$salt=generate_salt();
echo
"hash:".DoubleSaltedHash($pw, $salt);

?>

this is my way to crypt passwords

<< Back to user notes page

To Top