liveBook · Manning

Cryptographic salt

As explained in Just Use Postgres!

A cryptographic salt is a random value combined with a password before hashing to make identical passwords produce different hashes and to limit compromise scope.

A cryptographic salt is a random value combined with a password before hashing. Generating a fresh salt for every password makes identical passwords produce different hashes and limits a stolen salt's compromise to its associated password. section 7.2.2

Salted password storage in PostgreSQL

With pgcrypto enabled, create an account by combining the password with a Blowfish salt: INSERT INTO accounts (username, password_hash) VALUES ('ahamilton', crypt('SuperSecret123', gen_salt('bf'))); The resulting hash includes the salt. During login, pass the entered password and stored hash to crypt(); it extracts the stored salt and returns a matching row only when the password is correct.

Practical properties:

  • Generate a new random salt for every new password; avoid one fixed salt for all accounts. section 7.2.2

How Just Use Postgres! covers it

How deep it goes
Explains salt generation, hash storage, and verification SQL, but stops short of broader security administration.
Examples
Demonstrates pgcrypto account insertion, stored hash output, successful authentication, and failed-password behavior.
What it assumes
Assumes a PostgreSQL accounts table and teaches pgcrypto-based salting and verification through SQL examples.
What you can do after
Apply it via PostgreSQL pgcrypto to store and verify salted password hashes.
How it connects
Connects cryptographic salts with password hashing, authentication, PostgreSQL extensions, and Blowfish.

Also explained in

Compare how 5 books explain cryptographic salt →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.