Skip to main content
5 of 7
added 341 characters in body
Luc
  • 33.1k
  • 8
  • 81
  • 140

The answer is yes, you should always hash this.

Why do we hash stuff like passwords at all? Basically because people may use the same password for multiple services, and to prevent people from logging in with read-only database access.

So don't you think the user's first pet or mother's maiden name is also data that he would use across multiple services? Or that could potentially be used for social engineering attacks? Or could be used to reset the password and also gain access?

For that reason, you should protect answers to security questions against attackers (and admins!) the same way as you do with passwords.

Why not encrypt it?

Encryption is reversible, it makes it possible to access the data while there is no need to. One of the cases you're trying to prevent by protecting the database data, is a case where the server is compromised, or where an insider has bad intentions. In both cases, they could use the decryption key to reverse the protection. With decent hashing, this is no longer possible.

But what about punctuation? You can't match a hash unless it's exact.

People might use multiple words in an answer, and one time they might use capitalization, other times they might remove spaces between words or put a period behind the sentence... so I'd suggest normalizing it to remove spaces, punctuation and capital letters.

Luc
  • 33.1k
  • 8
  • 81
  • 140