Im trying to generate long htpasswd file with a lot of users (100+).
My DirectAdmin panel on linux server generates htpasswd file with password hashes starting with $1$.
I tried something like this:
function random_salt($length = 9) // 9 characters and $1$ = 12 characters
{
$chars = 'bcdfghjklmnprstvwxzaeiou';
for ($p = 0; $p < $length; $p++)
{
$result .= ($p%2) ? $chars[mt_rand(19, 23)] : $chars[mt_rand(0, 18)];
}
return $result;
}
echo crypt($myplainpassword, "$1$".random_salt());
It produces hash which starts with $1$, but server doesnt let me in. My passwords are 4-digit random "pin codes" generated in excel. Examples:
1215 5325 6261
What im doing wrong?