Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-07-2012, 09:23 AM   PM User | #1
probi
New Coder

 
Join Date: May 2012
Posts: 17
Thanks: 3
Thanked 1 Time in 1 Post
probi is an unknown quantity at this point
Using a salt value

Hi,

I've been reading up on using a salt value when creating a password to make it more secure, what I can't get my head round is how do you remember this salt value?

I'm guessing that when a user logs in to be able to compare the password entered with the one in the database you would need to again add the salt value to the entered password.

Am I missing something really obvious?

Thanks
probi is offline   Reply With Quote
Old 10-07-2012, 10:31 AM   PM User | #2
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
There is no way that you have to remember the salt - you ingrain it in the code. Maybe what you mean is that you don't want to use a constant salt. To have a variable salt you can use things like the username of the user as the salt, or the first 5 characters of the username i.e values that are not constant.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Old 10-07-2012, 10:51 AM   PM User | #3
probi
New Coder

 
Join Date: May 2012
Posts: 17
Thanks: 3
Thanked 1 Time in 1 Post
probi is an unknown quantity at this point
Ahhh ok, that makes far more sense, I was thinking that the salt value was being created randomly on the fly.

Thanks
probi is offline   Reply With Quote
Old 10-07-2012, 01:40 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Quote:
Originally Posted by probi View Post
Ahhh ok, that makes far more sense, I was thinking that the salt value was being created randomly on the fly.

Thanks
You can create it random for each person, but not on the fly during lookup. You can also use both a constant value and a stored value if desired. The primary purpose is that should a db become compromised and data is retrieved, than even if you do generate a collision match to the known hashed password, it would not be the correct one (or rather, it likely won't be the correct one). A secondary pro is that multiple user's whom happen to have the same password won't look like they do.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:01 PM.


Advertisement
Log in to turn off these ads.