[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
function rand_str($length = 40, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'
{
$chars_length = (strlen($chars) - 1);
$string = $chars{rand(0, $chars_length)};
for ($i = 1; $i < $length; $i = strlen($string))
{
$r = $chars{rand(0, $chars_length)};
if ($r != $string{$i - 1}) $string .= $r;
}
return $string;
}
$password = $_GET['id'];
$user_salt = rand_str();
echo "<b>Parola:</b> ".$password." <br />";
echo "<b>user_salt:</b> ".$user_salt." <br />";
echo "<b>user_password:</b> ".hash_hmac('sha256', $password, $user_salt);
?>[/syntaxhighlighter]
generatepassword.php?id=
passwordEDIT://
".hash_hmac('sha256', $password, $user_salt)"