0
0
Flaskframework~15 mins

Password hashing with Werkzeug in Flask - Mini Project: Build & Apply

Choose your learning style9 modes available
Password hashing with Werkzeug in Flask
📖 Scenario: You are building a simple Flask web app that needs to securely store user passwords. Instead of saving plain text passwords, you will use Werkzeug's password hashing utilities to protect user data.
🎯 Goal: Create a Flask app that hashes a user's password using Werkzeug's generate_password_hash function and then verifies it using check_password_hash.
📋 What You'll Learn
Create a Flask app instance
Import generate_password_hash and check_password_hash from werkzeug.security
Hash a plain text password using generate_password_hash
Verify the hashed password using check_password_hash
💡 Why This Matters
🌍 Real World
Web applications must never store plain text passwords. Using Werkzeug's hashing functions in Flask apps protects user data from leaks and hacks.
💼 Career
Understanding password hashing is essential for backend developers and security engineers working on user authentication systems.
Progress0 / 4 steps
1
Set up Flask app and import hashing functions
Create a Flask app by importing Flask from flask and instantiate it as app. Also import generate_password_hash and check_password_hash from werkzeug.security.
Flask
Need a hint?

Remember to import both generate_password_hash and check_password_hash from werkzeug.security.

2
Create a plain text password variable
Create a variable called plain_password and set it to the string 'MySecret123'.
Flask
Need a hint?

Assign the exact string 'MySecret123' to the variable plain_password.

3
Hash the plain text password
Create a variable called hashed_password and set it to the result of calling generate_password_hash with plain_password as the argument.
Flask
Need a hint?

Use generate_password_hash with plain_password to create the hashed password.

4
Verify the hashed password
Create a variable called is_correct and set it to the result of calling check_password_hash with hashed_password and plain_password as arguments.
Flask
Need a hint?

Use check_password_hash with hashed_password and plain_password to verify the password.