Why hash passwords?

I think you have missed the point @kfawcett

What Ben is saying is that he has been using password hashing for years already, and always does, however in the case of a hacker breaching his database and seeing a list of passwords all already hashed as they would now, surely more than just the password should be encrypted, such as the users private details, like their name, address, telephone number, etc.

Ben feel a sense of duty to protect his users passwords, and all their other details too, which is more than most of us do.

1 Like

For compromised DBs the usual approach is to use a pepper.

Yes, salt and pepper.

image

From wikipedia.

In cryptography, a pepper is a secret added to an input such as a password prior to being hashed with a cryptographic hash function. As of 2017, NIST recommends[1] using a secret input when storing memorized secrets such as passwords.

A pepper performs a comparable role to a salt, but while a salt is not secret (merely unique) and can be stored alongside the hashed output, a pepper is secret and must not be stored with the output. The hash and salt are usually stored in a database, but a pepper must be stored separately (e.g. in a configuration file) to prevent it from being obtained by the attacker in case of a database breach. Where the salt only has to be long enough to be unique, a pepper has to be secure to remain secret (at least 112 bits is recommended by NIST), otherwise an attacker only needs one known entry to crack the pepper. Finally, the pepper must be generated anew for every application it is deployed in, otherwise a breach of one application would result in lowered security of another application.

A pepper adds security to a database of salts and hashes because unless the attacker is able to obtain the pepper, they cannot crack a single hash, no matter how weak the original password. One downside of hashing passwords instead of encrypting passwords (assuming the encryption algorithm is strong and a strong key is used), is that an attacker can brute force the hashes and recover weak passwords. By contrast, with strong encryption, the attacker has to brute force a strong key (which may be physically impossible) before they can decrypt a single password. The encryption equivalent of a pepper is the encryption key. By including pepper in the hash, one can have the advantages of both methods: uncrackable passwords so long as the pepper remains unknown to the attacker, and even if the pepper is breached, an attacker still has to brute force the hashes. For comparison, when encrypting passwords, anyone with knowledge of the encryption key (including system administrators) can instantly decrypt all passwords; hence, it is always recommended to hash passwords instead of encrypting them, even when not using a pepper.

1 Like

This has been a good discussion and read. Thanks!

2 Likes