Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: NSMarko - elokuu 15, 2014, 08:07:49 AP

Otsikko: custom hash
Kirjoitti: NSMarko - elokuu 15, 2014, 08:07:49 AP
hi, I was thinking about merging a games database with SMF's so when the users register ingame, they get a forum profile, but my problem is that I'm kinda new with SMF and can't find where does SMF merge the hash and the salt. I first put in the salt and then the hashed pass... and yeah sha1 for passwords
Otsikko: Re: custom hash
Kirjoitti: margarett - elokuu 15, 2014, 08:12:09 AP
Welcome ;)

SMF hashes the user password with sha1(strtolower($username) . $password)
Otsikko: Re: custom hash
Kirjoitti: NSMarko - elokuu 15, 2014, 08:21:21 AP
thanks for that info, I found something in Load.php can you tell me if thats it?

elseif (strlen($password) == 40)
$check = sha1($user_settings['passwd'] . $user_settings['password_salt']) == $password;
else
$check = false;

and my hash is a bit longer, so I would change it to :
elseif (strlen($password) == 70)
$check = sha1($user_settings['salt'] . $user_settings['lozinka']) == $password;
else
$check = false;

my salt is 30 characters long so its 40+30 = 70, is that correct?
Otsikko: Re: custom hash
Kirjoitti: margarett - elokuu 15, 2014, 08:58:10 AP
Nop, you don't need salt. It is used for cookie login only. The user+pass combination is processed in LogInOut.php ;)
Otsikko: Re: custom hash
Kirjoitti: NSMarko - elokuu 15, 2014, 09:18:57 AP
thanks for the support, I should roam around the files to find more stuff.