AP Computer Science Principles · Unit 5 lecture · Part 8 of 11 · 8 min

5.6 Safe computing: authenticationProving you are you

Mr. Thompkins
The most common way accounts get broken into isn't some movie-style hack. It's a weak or reused password. Good news: that's the easiest thing to fix, and you'll know exactly how by the end of this section.

Authentication measures protect devices and information from unauthorized access. The two the CED names are strong passwords and multifactor authentication. A strong password is something that is easy for a user to remember but would be difficult for someone else to guess based on knowledge of that user. Your dog's name plus your birth year fails that test, because anyone who follows you online knows both.

?Wait, why is length so powerful?
Each extra character multiplies the number of possible passwords. With 26 letters, each new letter multiplies the possibilities by 26. Powers grow fast: you saw that with bits in Unit 2, where each extra bit doubles the number of values.

Beyond the course, as a bonus: the math behind "longer is stronger". An attacker with a stolen file of scrambled passwords can test guesses very fast, so suppose 10 billion guesses a second. The table shows how many possible passwords each style has and the longest such an attacker would need to try them all.

Password stylePossible passwordsWorst case at 10 billion/s
4-digit PIN10,000about a millionth of a second
8 lowercase lettersabout 209 billionabout 21 seconds
8 letters and digits, mixed caseabout 218 trillionabout 6 hours
4 random words (7,776-word list)about 3.7 quadrillionabout 4.2 days
12 letters and digits, mixed caseabout 3.2 sextillionabout 10,000 years
6 random wordsabout 221 sextillionabout 700,000 years
Bonus: possible passwords and worst-case guessing time at a hypothetical 10 billion guesses per second. Length and randomness win. A real attacker tries common passwords first, so predictable ones fall much faster.

Using a different password on every site matters just as much. When one site leaks its passwords, and some always do, attackers try those same email and password pairs on banks, email and social media. A unique password per site means one leak stays one leak. A password manager can remember them for you.

Multifactor authentication is a method of computer access control in which a user is only granted access after successfully presenting several separate pieces of evidence to an authentication mechanism, typically in at least two of three categories: knowledge (something they know), possession (something they have) and inherence (something they are). Multifactor authentication requires at least two steps, and each step provides a new layer of security that must be broken to gain unauthorized access.

CategoryExamplesStolen by
Something you knowPassword, PIN, answer to a security questionPhishing, keylogging, guessing, a data breach
Something you havePhone that gets a code, security key, ID badgePhysically taking the item
Something you areFingerprint, face scan, voiceVery hard to copy
The three categories. Multifactor means evidence from two different rows, not two items from the same row.
?Wait, isn't a username a factor?
No. A username only says who you claim to be; it isn't evidence that you are that person. Usernames are often public. In "username plus password", only the password is a factor, so that login is single-factor.
Pause and think
An attacker tricks you into typing your password into a fake site. Your account uses a password plus a code sent to your phone. Predict what the attacker can do next, and why.
I thought about it. Show me
Not much. They have something you know, but not something you have: your phone. Without the code, the login fails. That's exactly the "new layer of security" multifactor adds. (Stay alert anyway: a clever fake site may also ask you for the code, so never type a code into a page you reached from a link.)
Analyze these logins
Decide whether each login is multifactor, and name each factor's category: (a) a password and then a 4-digit PIN; (b) tapping a building badge and then scanning a fingerprint; (c) a password and then answering "What city were you born in?"; (d) a face scan and then a code from an app on your phone.
  1. Sort every piece of evidence into know, have or are.
    Why?
    Multifactor depends on categories, not on the number of steps. Three passwords would still be one factor.
  2. (a) Password: know. PIN: know. One category: not multifactor.
  3. (b) Badge: have. Fingerprint: are. Two categories: multifactor, and no password at all.
  4. (c) Password: know. Security question: know. Not multifactor, and a birthplace is easy to find online.
  5. (d) Face scan: are. Code from an app on your phone: have. Two categories: multifactor.

Answer: (b) and (d) are multifactor. (a) and (c) use two things you know, so they are single-factor.

Stuck? Get a hint
  1. Label each piece: know, have or are.
  2. A PIN and a security question are both things you know.
  3. Multifactor needs at least two different labels.
Check yourself
Which of the following is an example of multifactor authentication?
  1. AEntering a password, then entering a second, different password
  2. BEntering a password, then entering a code sent to your phone
  3. CEntering a username, then entering a password
  4. DAnswering two security questions
Show the answer

B. A password is something you know, and the code proves you have your phone: two different categories. Every other choice is one category, things you know, and usernames aren't evidence at all.

Exam tip from Mr. T

On multifactor questions, write K, H or A (know, have, are) above each piece of evidence in the choices. The right answer is the only one with two different letters.

  • Strong password: easy for you to remember, hard for anyone to guess, even someone who knows you. Longer and more random is stronger.
  • Use a different password for every site.
  • Multifactor authentication: at least two categories of evidence (know, have, are). Each step adds a layer an attacker must break.