Passwords and authentication
Proving who you are
- Authentication means proving you are who you claim to be. There are three classic ways:
- Something you know (a password), something you have (a phone), something you are (a fingerprint).
Stronger logins
- Biometrics — fingerprints or face scans; hard to steal, but not perfect.
- Two-factor authentication (2FA) — a password plus a one-time code from your phone.
- A stolen password alone is then not enough to log in. 2FA is not perfect: a fake login page can ask for the code too, so still check the address.
What makes a password strong?
- Length beats everything. Each extra character multiplies the guesses an attacker needs.
- A mix of letters, digits, and symbols helps — but a long passphrase like
correct horse battery stapleis both strong and memorable.
Build a checker
- Below, write a tiny rule: a password is "strong" only if it is long enough and has a digit.
- Real checkers also reject common passwords like
123456andpassword.
Covers: IGCSE 5.3 (authentication), A-Level 6.1, AP CSP Big Idea 5.
Common mistakes
- Long and unique beats short, complex, but reused.
- Two-factor authentication adds a second, different check.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
Write a simple strength checker. A password is strong if it is at least 8 characters AND contains a digit; otherwise weak. Print the right word for the given password.
Click Run to see the output here.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
Real checkers also reject common passwords. Improve the rule: if the password is in the common list it is weak no matter what; otherwise apply the old rule (length ≥ 8 AND a digit). Print the verdict.
Click Run to see the output here.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
A helpful checker says what is missing. Write missing(password), which returns a list of the failed rules, in this order: "length" (fewer than 8 characters), "digit" (no digit), "upper" (no capital letter). A password that passes every rule gives [].
Click Run to see the output here.