Jump to content
  • 0

Not Getting Lost Password Email For Admin Account


gutterboy

Question

17 answers to this question

Recommended Posts

  • 0

Doesn't it use a salt?

 

Haven't looked into the password algorithms but each password in the DB has the same string preprended to it which I assume is the salt. That said, two passwords which I know are the same still had a different hash. I tried copying the hash from one user to the other and was able to log in though.

Link to comment
Share on other sites

  • 0

Found a good overview of bcrypt, it actually has built in salts: http://stackoverflow.com/a/6833165/1595084 Even though the salt is different for each password you should be able to use the hash in the database for a different user since the salt is stored with the cipher text.

 

This is bcrypt:

Generate a random salt. A "cost" factor has been pre-configured. Collect a password.

Derive an encryption key from the password using the salt and cost factor. Use it to encrypt a well-known string. Store the cost, salt, and cipher text. Because these three elements have a known length, it's easy to concatenate them and store them in a single field, yet be able to split them apart later.

When someone tries to authenticate, retrieve the stored cost and salt. Derive a key from the input password. Encrypt the same well-known string. If the generated cipher text matches the stored cipher text, the password is a match.

Bcrypt operates in a very similar manner to more traditional schemes based on algorithms like PBKDF2. The main difference in its use of a derived key to encrypt known plain text; other schemes (reasonably) assume the key derivation function is irreversible, and store the derived key directly.

Stored in the database, a bcrypt "hash" might look something like this:

$2a$10$vI8aWBnW3fID.ZQ4/zo1G.q1lRps.9cGLcZEiGDMVr5yUP1KUOYTa

  • 2a identifies the bcrypt algorithm version that was used.
  • 10 is the cost factor; 210 iterations of the key derivation function are used (which is not enough, by the way. I'd recommend a cost of 12 or more.)
  • vI8aWBnW3fID.ZQ4/zo1G.q1lRps.9cGLcZEiGDMVr5yUP1KUOYTa is the salt and the cipher text, concatenated and encoded in a modified Base-64. The first 22 characters decode to a 16-byte value for the salt. The remaining characters are cipher text to be compared for authentication.
  • $ are used as delimiters for the header section of the hash.
Link to comment
Share on other sites

  • 0

Found a good overview of bcrypt, it actually has built in salts: http://stackoverflow.com/a/6833165/1595084 Even though the salt is different for each password you should be able to use the hash in the database for a different user since the salt is stored with the cipher text.

 

 

Don't know if it's that easy see this: http://www.blesta.com/forums/index.php?/topic/996-store-password-in-databse-crypted-an-use-it-in-php/?p=8091

Link to comment
Share on other sites

  • 0

Well isn't the point of salts to avoid having users with the same password getting the same hash?

That's one of the reasons, the other is to hinder the use of rainbow tables. Even if each user has the same salt and therefore the same hash, the salt would prevent them from using any previously existing rainbow tables. They could generate a rainbow table for that particular salt though, which is why having a separate salt per user is better as each user would need their own rainbow table (e.g. plain old brute force)
Link to comment
Share on other sites

  • 0

That's one of the reasons, the other is to hinder the use of rainbow tables. Even if each user has the same salt and therefore the same hash, the salt would prevent them from using any previously existing rainbow tables. They could generate a rainbow table for that particular salt though, which is why having a separate salt per user is better as each user would need their own rainbow table (e.g. plain old brute force)

 

Well yeah......... pretty useless if users all had the same salt haha...... as then they would have the same hash anyway. :P

Link to comment
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...