views:

98

answers:

2

Is there a good algorithm for this? after an amount of searching around I haven't been able to find any conclusive answers.

Basically in a system which collects various bits of data about its users, each user is identified by a 64 bit unique Id. this Id is used as a primary key to a data set which may include any amount of data collected from this user. as is, this works fine as the Id's are already unique, but for legal reasons I need to hash the Id's in a way that I cannot link them back to the actual person. but at the same time needing to guarantee the uniqueness of the ID.

Obviously with the values being unique it would be possible to reverse engineer the algorithm used. but I'm not so sure that it being 100% unbreakable is so much of an issue here rather than making it so there isn't an easy way of reversing it

thanks

A: 

Is there any reason why Unique ID needs to be the primary key? May be you could use some other primary key(Hash of the id) and store a encrypted primary user name which is encrypted using a known key.

As far as i know a hash value cannot be reversed

Naresh
Unique id is the only unique info relating to a user, a username can be whatever the user chooses at any time and can change, as it is simply a display name.
Stowelly
+3  A: 

For each ID generate a unique random ID and store it as part of the users information.

Then you can get from an ID to hash. The reverse is computationally possible (as you must scan the whole key space) but excessively hard and time consuming.

Martin York
I quite like this answer, thanks a lot!
Stowelly