Password security & hashing (concept)

Computer Science · Cybersecurity

Question 1 of 10

0

    Password spraying means:

    Stuck? Read the explanation

    Unlocks at a streak of 5 correct answers in a row.

    Print a free worksheet (PDF)

    Embed this practice on your site or class page

    Paste this HTML into your page. Students practise right there; it is free and needs no account.

    Password security & hashing (concept) explained

    Passwords should never be stored in plain text, because anyone who reads the database would see every password. Instead, a system stores a hash: a fixed-length output produced by a one-way function. Hashing the same input always gives the same output, but the output cannot be turned back into the original password. When you log in, the system hashes what you typed and compares the result with the stored hash.

    Hashing is one-way, whereas encryption is designed to be reversed by someone holding the correct key.

    A salt is a random value added to each password before it is hashed. Two users with the same password then get different stored hashes, which stops an attacker using one precomputed table for every account.

    A common mistake is to think that hashing alone makes a password safe. Fast hash functions such as plain MD5 or SHA-256 can be tried extremely quickly, so systems should use slow, purpose-built password hashing methods such as bcrypt, scrypt or Argon2.

    Worked example

    Compare two 8-character passwords. Lowercase letters give 26 choices per character, while letters in both cases plus digits give 62 choices.

    1. Lowercase only: 268=20882706457626^8 = 208827064576 possible passwords.
    2. Letters and digits: 628=21834010558489662^8 = 218340105584896 possible passwords.
    3. The second set is over 1,000 times larger. At one billion guesses per second, trying every lowercase password would take about 3.5 minutes, and trying every letter and digit password would take about 2.5 days. These figures are illustrative.

    What you will practise

    100 multiple-choice questions (Easy, Medium, Hard). Each answer is followed by an explanation.

    Example questions

    • Strong passwords should be:
    • Password managers:
    • Hashing:
    • Salting adds:
    • Two-factor authentication adds:
    • Storing passwords in plain text is especially risky because:
    • Which of these is a password-hashing algorithm designed to be deliberately slow?
    • Base64 is best described as:

    …and 92 more.