Question create a unique Key code for every records?

Joined
Oct 22, 2013
Messages
1
Programming Experience
1-3
I'm looking to create a unique Key code for every records, based on these fields:

SSN
Last Name
First Name
DOB

ex:
-------------------------------------------------------------
SSN Last Name First Name DOB KEY
-------------------------------------------------------------
111-11-111 Joe First 10/01/1972 ??????????
222-22-222 Joe Tirsf 01/10/1972 ??????????

The key must be different for each record, but must be able to re-create the exact same key with the same values

Please Help

can reply also to: felix.fernandez.rd at gmail


Thank you
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,150
Location
Sydney, Australia
Programming Experience
10+
It's going to be almost impossible to 100% guarantee that a single value generated from multiple other values is unique but you can do it so that the likelihood is so small as to be insignificant. You can combine the values in whatever way you see fit, e.g. convert all to Strings and simply concatenate, and then hash that value, using the MD5 or SHA1 algorithm.
 
Top Bottom