I understand your point of view based on the fact that you are trying to hide social security numbers. If someone knows that you are using SHA1HASH in the SSN to create a unique identifier, you can simply generate a quick list of all SSNs, SHA1HASH, and then compare to automatically include the person’s SSN in the records. Worse, they can generate all this in a hash lookup table and have a 1 hash key for each SSN. This is called a hash lookup table, and more complex forms are called rainbow tables.
This is why the second hashing feature was invented. This is called salting. Salting is basically it; You create a salt, then modify your data using the salt. For example, let's say you had SSN 123-45-6789. You could salt it with the sequence "MOONBEAM". Your new hash line is "123-45-6789MOONBEAM"
Now, even if someone knows that you have hashed an SSN to generate your unique identifier, he still does not know what salt you will use, and therefore cannot get the original SSN, having previously hashed the list of all SSNs and compared to your identifier . However, you can always take a custom SSN, use salt, and rephrase SSN + SALT to check if the user SSN matches its identifier.
Finally, if you use only 1 salt for everything and keep it a secret, instead of seeing the salt and generating the corresponding SSN, by increasing the SSN + salt 100 million times and choosing a match, they should do a lot more work to find the SSN. This is because 100 million SSNs have a relatively low amount of entropy. (10 ^ 9 combinations). By adding salt and keeping it secret, instead of just starting
SHA1HASH(111-11-1111) -> check hash match SHA1HASH(111-11-1112) -> check hash match SHA1HASH(111-11-1113) -> check hash match
They had to run
SHA1HASH(111-11-1111a) -> check hash match SHA1HASH(111-11-1111b) -> check hash match SHA1HASH(111-11-1111c) -> check hash match ... SHA1HASH(111-11-1111azdfg) -> check hash match SHA1HASH(111-11-1111azdfh) -> check hash match .... SHA1HASH(111-11-1111zzzzzzzzzzzzzzzz) -> check hash match SHA1HASH(111-11-1112a) -> check hash match SHA1HASH(111-11-1112b) -> check hash match
.. and so on until they finally get to
SHA1HASH(123-45-6789MOONBEAM) -> check hash match
at that moment they finally managed to crack SSN + SALT
They don’t even know how many characters in your salt. So 10 ^ times (the number of characters in your salt) they need more to get only 1 SSN, not to mention the whole table.
Update: many years later, I see that my salting information was incorrect when I answered this question. Please see the correct information in the posts and comments below about using unique salts for each entry, as this is still the first entry in the chain. If you think that I should change the OP after reading it, leave a comment below (or add one vote), and if consensus is reached, I will correct it.