1

I think the title says it all, but how does this work?

If a salt is generated randomly, wouldn't that make it impossible to later compare?

I'm following these docs: https://www.postgresql.org/docs/current/static/pgcrypto.html (F.25.2. Password Hashing Functions)

1 Answers1

1

Re: @erickson 's answer here How can bcrypt have built-in salts?

it appears that the hashing algorithm used is recorded in the encrypted string that is produced from the hash action. Can anyone confirm this works the same way for postgres?

Community
  • 1
  • 1
  • According to the documentation, yes. You need to do `SELECT pswhash = crypt('entered password', pswhash)` (where `pswhash` is a column/value in the database) to re-check passwords. (If you look closely, you can see that the "hash" is used in place of the `gen_salt()` call upon checking). – pozs Feb 13 '17 at 14:47