liveBook · Manning

Cryptographic hash

As explained in Build Python Web Apps with Streamlit

A cryptographic hash function transforms input into a fixed-looking digest such that recovering the original input is computationally difficult.

A cryptographic hash transforms a password into a random-looking value that is difficult to reverse. Store the hash instead of the plaintext password, so a database breach does not immediately reveal users’ passwords. section 8.3.2

Comparing password hashes

For a password such as SomePassword123, calculate H(password) during account creation and store the resulting password_hash. During login, hash the entered password again and authenticate when the result matches the stored value. section 8.3.2

How Build Python Web Apps with Streamlit covers it

How deep it goes
Explains one-way behavior and demonstrates bcrypt storage and verification, without descending into hashing algorithms’ mathematics.
Examples
Uses a password-to-digest comparison, a bcrypt User model, and a database row containing a password_hash.
What it assumes
Assumes passwords and database storage, while teaching the security problem and one-way hashing from a plain-language analogy.
What you can do after
Apply bcrypt to store password hashes and verify entered passwords in a Python authentication service.
How it connects
Connects password security with databases, authentication, user services, and one-way functions.

Also explained in

Compare how 4 books explain cryptographic hash →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Python Web Apps with Streamlit. The section links point to the parts of the book it draws on.