Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m currently going through a course on software security. I\'ve recently been

ID: 661151 • Letter: I

Question

I'm currently going through a course on software security. I've recently been introduced to the idea of password salting, where a random value is concatenated to a password prior to being hashed and stored. I believe I understand the operation correctly, but I don't understand how this makes the process itself any more secure.

Obviously, for authentication to occur, there has to be a reference to the salt used for the specific password during creation, thus creating a matching hash. In this reference there is a direct link to both the salt and the password/hash. If a perpetrator has access to the database, thus compromising both the hashes and salts, would he not have access to the algorithm or references to the salt as well?

Based on my understanding of salting, this method seems to be security by obscurity.

Explanation / Answer

This topic has really been discussed to death, so this is only the short version.

Salts have several benefits. The most important one is that it forces an attacker to break each hash individually.

Without salts, the attacker needs to go through his list of possible passwords just once. For each item, he calculates the hash and checks if it matches any of the stored hashes. So to search a space of n possible passwords, the attacker needs at most n hash calculations.

With salts, you effectively hash every password with a unique variation of the basic hash algorithm. Now an attacker can't just do one calculation and compare the result with all stored hashes. They need to attack each hash individually. So if there are m stored hashes with unique salts, searching a space of n possible passwords requires at most m * n hash calculations. That's m times as much effort as before.

The salts do not have to be secret. They only need to be sufficiently random so that they're indeed unique (not just in your own application but globally). 16 bytes from a source like /dev/urandom are fine.

Note, however, that salts do not magically turn weak hash algorithms into strong ones. They do not protect a particular hash. They also don't help if the underlying hash algorithm is so fast that an attacker can easily make up for the extra effort.

So concepts like

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote