title: Hashing SSNs and other limited-domain information
body: <p>I'm currently working on an application where we receive private health information.  One of the biggest concerns is with the SSN.  Currently, we don't use the SSN for anything, but in the future we'd like to be able to use it to uniquely identify a patient across multiple facilities.  The only way I can see to do that reliably is through the SSN.  However, we (in addition to our customers) REALLY don't want to store the SSN.  </p>
  
  <p>So naturally, I thought of just SHA hashing it since we're just using it for identification.  The problem with that is that if an attacker knows the problem domain (an SSN), then they can focus on that domain.  So it's much easier to calculate the billion SSNs rather than a virtually unlimited number of passwords.  I know I should use a site salt and a per-patient salt, but is there anything else I can do to prevent an attacker from revealing the SSN?  Instead of SHA, I was planning on using BCrypt, since Ruby has a good library and it handles scalable complexity and salting automagically.</p>
  
  <p>It's not going to be used as a password.  Essentially, we get messages from many facilities, and each describes a patient.  The only thing close to a globally unique identifier for a patient is the SSN number.  We are going to use the hash to identify the same patient at multiple facilities.</p>