Jump to content

hash, sha1


Ninjakreborn

Recommended Posts

I am a little confused on how to hash, and there's not tutorials on it, if I pick salts and I forget what the salt is for each one, I will lose them, the same way with key handling. 
Sha1, Hash, mdhash, how do I hash them then compare the passwords up against the hash after I get the input from the form?
Link to comment
Share on other sites

I use MD5 hashing for my passwords

$password = "pass";

$md5_pass = md5($password); (insert this into your database)


After your user goes through the login convert the inputed password to md5 (like above) and query your database with it. (SELECT * FROM users where username = $username AND password = $md5_pass)

Something like that.

Hope that helped,
-Chris
Link to comment
Share on other sites

If someone gets a users password (after having been hashed), its _EASY_ to find a collision for it. (allowing them to log in as that user)

If someone gets a users password (after having been salted, then hashed), they may find a collision, but it will do them little good unless they can also get the salt, and algorythum used to hash the password.
Link to comment
Share on other sites

Ok that was what I don't understand then, how do I overcome the issue, do I use the exact same salt for every single password, like salt it with
$salt = brcca
for instance, just something random, or a big word, or sentence or something, then when I hash the other password for comparison, then I wuold just use the exact same salt, and if used with the same salt for all the passwords, it will work them all correctly right.
I just need hash, get inputted password, hash, then match them up, which is all fine and good, I just want to make sure the salt, using the same oen over and over again, will always have a 100% compared affect.  Unlike the stupid crypt() function, that is totally off.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.