The Austrian electronic ID card relies on the so-called sector identifiers. For example a hospital gets to identify a person by getting a sectorId for that person, which is computed roughly as follows:
sha1(personalId + "+" + prefix + sectorId); // prefix is constant and irrelevant
Is that a good idea? I think the possibility of collision, no matter how small, poses a risk.
In hashtables, when there's a collision, you have other means of establishing equality, but with primary keys you can't possibly have two that are identical. That can be circumvented by a composite key, but then the point of a unique sector identifier is lost.
Is it ok to do that and is there a good way to have it that way without it breaking at some point?
personalId
+sectorID
will already serve as a unique identifier, and since there is nothing in there like a password which must be hidden, hashing seems of no actual use. What am I missing? Or is the "personID" something secret? – Doc Brown Aug 19 '15 at 17:39