Information Security Basics

When a web service stores users' passwords, it adds a random value that differs for each user (a salt) to the password before computing and storing the hash value. What is the main purpose of the salt?

  1. ATo allow the original password to be recovered from the hash value using the salt, so it can be sent to users who forget it
  2. BTo make the stored hash values differ even when users share the same password, making cracking with tables of precomputed hash values difficult
  3. CTo shorten the hash value and save database space
Show answer and explanation

Answer: B. To make the stored hash values differ even when users share the same password, making cracking with tables of precomputed hash values difficult

The basic rule is not to store passwords as they are but to store hash values computed with a hash function. At login, the hash of the entered password is computed and compared with the stored value. If only plain hash values are stored, however, users with the same password have the same hash, and simply looking up a table of precomputed hashes of common passwords (such as a rainbow table) reveals many passwords. A salt is a value generated randomly for each user, added to the password and stored together with the hash. The salt does not need to be secret, but because it differs for each user, the same password gives different hash values and precomputed tables become useless. An attacker has to redo the computation for each user, which greatly increases the effort.

  • A. A hash function cannot be reversed, so the password cannot be recovered even with the salt. Users who forget a password go through a reset procedure instead.
  • B. Correct. The hash values differ per user, making cracking with precomputed tables difficult.
  • C. Adding a salt does not change the length of the hash value; if anything, storing the salt increases the data stored.
Practice this topic Back to topic

Related calculators

Books on Information Security Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Information Security Basics questions

  1. For storing passwords, it is recommended not to use a fast hash function such as SHA-256 directly but a scheme deliberately designed to take time to compute, such as bcrypt or Argon2. Why?
  2. An 8-character password is searched for by brute force, trying every candidate. If 1×10^10 candidates can be tried per second, which combination is closest to the time needed to try all candidates for a password made only of lowercase letters (26 kinds) and one made of uppercase letters, lowercase letters and digits (62 kinds)?
  3. A attaches a digital signature to a document sent to B. Which combination correctly gives the keys used to create and verify the signature and what the digital signature can confirm?
  4. Which statement correctly compares a message authentication code (MAC) with a digital signature?
  5. It has been discovered that the private key corresponding to a web server's server certificate may have been leaked. The certificate has not yet expired. What is the most appropriate action for the operator?