Post number #80237, ID: cc6795
|
do i store the salt as another field in the database?
Post number #80238, ID: cc6795
|
how*
Post number #80246, ID: a44833
|
Why would you store the salt as a field in a database? That defeats the entire point of salting to begin with.
Post number #80720, ID: cc6795
|
>>80246 that's why i'm asking
Post number #80721, ID: cc6795
|
how would you match the password then?
Post number #80856, ID: f866d0
|
It's to prevent users' original passwords from being compromised in the event of a breach. And to prevent rainbow table attacks
Post number #80857, ID: f866d0
|
>>80721 You match with the salted and hashed password
Post number #80867, ID: adce6d
|
>>80237 What PHP's built-in functions do is put the salt (and length of the salt as a decimal number) at the start of the hash. When comparing hashes, it splits that up into the hash and the salt, combines the input password with the salt, hashes it, and compares the hashes.
Post number #80872, ID: adce6d
|
So in the "password" field in the database it stores something like this: (salt)(hash of (salt . password)) Then to compare you check if (salt . input password) matches the hash in the password field. You can also put the salt in a separate database field as long as you still do hash(salt+password) for both setting and checking the password. It is recommended to generate a new cryptographically secure random salt of at least 11 characters when changing the password.
Post number #80903, ID: 648520
|
Huh
Post number #81020, ID: 6d7d3d
|
mad sus
Post number #81174, ID: cc6795
|
well so it works like i imagined it to be, but now i'm just confused by the first comment
Post number #81403, ID: 7345a2
|
>>80237 Store in a cool dry place, usually beside the spices
Post number #81517, ID: cc6795
|
>>81403 aww shucks. my place is kinda lame. i can't find a single cool spot to put the salt
Total number of posts: 14,
last modified on:
Sat Jan 1 00:00:00 1514119172
| do i store the salt as another field in the database?