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?