0
0
Flaskframework~5 mins

Password hashing with Werkzeug in Flask - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of password hashing in web applications?
Password hashing protects user passwords by converting them into a secure, unreadable format. This way, even if the database is leaked, attackers cannot see the original passwords.
Click to reveal answer
beginner
Which Werkzeug functions are commonly used for password hashing and verification?
Werkzeug provides generate_password_hash() to create a hashed password and check_password_hash() to verify a password against its hash.
Click to reveal answer
beginner
How do you hash a password using Werkzeug in Flask?
Use generate_password_hash(password) where password is the plain text password. It returns a hashed string safe to store in the database.
Click to reveal answer
beginner
How do you check if a user-entered password matches the stored hash?
Use check_password_hash(stored_hash, password). It returns True if the password matches the hash, otherwise False.
Click to reveal answer
beginner
Why should you never store plain text passwords in your database?
Storing plain text passwords risks user security if the database is leaked. Hashing ensures passwords are protected and unreadable by attackers.
Click to reveal answer
Which Werkzeug function creates a hashed password?
Averify_password()
Bcheck_password_hash()
Chash_password()
Dgenerate_password_hash()
What does check_password_hash() return if the password matches?
AThe hashed password
BTrue
CFalse
DThe plain password
Why is hashing passwords important?
ATo protect passwords if the database leaks
BTo speed up login
CTo make passwords longer
DTo store passwords in plain text
Which of these is NOT a good practice for password security?
AHashing passwords before storing
BUsing <code>generate_password_hash()</code>
CStoring plain text passwords
DVerifying passwords with <code>check_password_hash()</code>
What type of value does generate_password_hash() return?
AHashed password string
BBoolean
CPlain text password
DInteger
Explain how to securely store and verify passwords in a Flask app using Werkzeug.
Think about the two main Werkzeug functions and why hashing is important.
You got /4 concepts.
    Describe why password hashing is critical for user security and what risks it prevents.
    Consider what happens if passwords are stored as plain text.
    You got /4 concepts.