I got a site with users in a database, clear text passwords.
I would like to insert (and synchronize) these users into G2.
I understand that the hashing algorithm for G2 is the following:
Quote:
function md5Salt($password, $salt='') {
if (empty($salt)) {
for ($i = 0; $i < 4; $i++) {
$char = mt_rand(48, 109);
$char += ($char > 90) ? 13 : ($char > 57) ? 7 : 0;
$salt .= chr($char);
}
} else {
$salt = substr($salt, 0, 4);
}
return $salt . md5($salt . $password);
}
therefore I wrote a little script, changing my user passwords into G2-hashed passwords:
Quote:
while (list($db_id,$db_vorname,$db_nachname,$db_cerevis,$db_email,$db_passwort) = mysql_fetch_row( $result_liste )) {
$full_name = "$db_vorname $db_nachname";
for ($i = 0; $i < 4; $i++) {
$char = mt_rand(48, 109);
$char += ($char > 90) ? 13 : ($char > 57) ? 7 : 0;
$salt .= chr($char);
}
$enc_pw = $salt . md5($salt . $db_passwort);
$salt ='';
}
if I manually copy $enc_pw into the table g2_user and try to login, it tells me that i would have provided the wrong password...
What is wrong?
Posts: 5
Got it - works perfectly!
Thanks,
darrin
Posts: 32509
see:
http://gallery.menalto.com/node/61542
--------------
Doumentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage