Recall & Review
beginner
Why should passwords never be stored in plain text?
Storing passwords in plain text is dangerous because if the database is hacked, attackers get direct access to user passwords. This can lead to account theft and further security breaches.
Click to reveal answer
beginner
What is hashing in the context of password storage?
Hashing is a one-way process that converts a password into a fixed-length string of characters. It is designed so you cannot reverse it to get the original password, making it safer to store.
Click to reveal answer
intermediate
What role does a salt play in password hashing?
A salt is a random string added to a password before hashing. It ensures that even if two users have the same password, their hashes will be different, protecting against attacks using precomputed tables.
Click to reveal answer
beginner
Which Python library is recommended for secure password hashing in Flask?
The 'werkzeug.security' module is recommended in Flask. It provides functions like generate_password_hash() and check_password_hash() to safely hash and verify passwords.
Click to reveal answer
intermediate
Why is using a slow hashing algorithm important for password storage?
Slow hashing algorithms make it harder for attackers to try many password guesses quickly. This reduces the risk of brute-force attacks and improves security.
Click to reveal answer
Which of the following is the safest way to store passwords in a Flask app?
✗ Incorrect
Using werkzeug.security's generate_password_hash adds salt and uses a strong hashing algorithm, making it the safest option.
What does adding a salt to a password hash prevent?
✗ Incorrect
Salts prevent rainbow table attacks by making each hash unique, even for identical passwords.
Which function in Flask's Werkzeug library checks if a password matches its hash?
✗ Incorrect
check_password_hash() compares a stored hash with a password attempt securely.
Why should password hashing algorithms be slow?
✗ Incorrect
Slow hashing algorithms increase the time needed for each guess, making brute-force attacks less practical.
What is a common hashing algorithm used by generate_password_hash in Flask?
✗ Incorrect
generate_password_hash uses PBKDF2 by default, which is a slow and secure hashing algorithm.
Explain the steps you would take to securely store user passwords in a Flask application.
Think about how to protect passwords from attackers if the database is leaked.
You got /5 concepts.
Describe why salting passwords is important and how it improves security.
Consider what happens if two users have the same password.
You got /4 concepts.