I want to securely store a database table that consists of an account ID and a few columns of sensitive data. The data only has value if it can be associated with the account ID. My thinking is to hash the account ID so it can't be associated with the sensitive data.

What hashing algorithm should I used for this situation? Is there an alternative way to store the data that would provide stronger security?


Simply hashing the account ID will not prevent people from associating the account because they can just hash the ID themselves assuming they know the ID and have access to the table.

If the data is so sensitive, you need to encrypt the entire table regardless of how you hide the ID. As I don't know your intentions, it's possible to associate an account entirely on the sensitive data.

If encryption of the table still doesn't suit you, and you are just toying with the idea of trying to disassociate an ID with the table entry, you can try a HMAC (Hash-Based Message Authentication Code) which can take an ID with some secret key to make a difficult to reverse hash. Good Luck!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.