MyBB Community Forums

Full Version: How to salt password?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anybody know how to implement a salt function to salt the md5-ed pass like on mybb on my project?
The MyBB Salt function is like this:
function salt($password, $salt)
{
    return md5($password . md5($salt));
}
Then in login how do u check the salted pass?
(2008-07-01, 07:33 PM)dikidera Wrote: [ -> ]Then in login how do u check the salted pass?

function salt($password, $salt)
{
return md5($password . md5($salt));
}

if (isset($password => $salt))
{
    continue;
}
else
{
    exit;
} 

I think this is right

no sleep for me today
Do i need a field for salt?
(2008-07-01, 08:29 PM)dikidera Wrote: [ -> ]Do i need a field for salt?

You need to store it in a column under your users table.
Also, don't forget to call it from the database.
A new table or column?
A column in your user's table would be the best solution.
I've been considering adding the salt some time now but due to some users registering before implementing this it will be hard
I may have to do truncation