← Courses

Defensive Security Essentials

Cybersecurity

Common Threats · Lesson 4 of 11

Passwords and authentication

The front door

Passwords are the front door to almost everything, and weak ones are still the most common way attackers get in. Two ideas keep that door shut: strong passwords, and a second lock called two-factor authentication (2FA).

A strong password is long and hard to guess. Length matters more than symbols: a long phrase beats a short scramble.

Systems should never store your raw password. They store a scrambled version called a hash. Run this to see hashing in action:

Python

Run it again with a different password and watch the hash change completely. A site checks your login by hashing what you type and comparing, so it never needs your real password on file.

Exercise

Exercise — check your understanding

Write a function is_strong(pw) that returns True if the password is at least 12 characters long, and False otherwise.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →