[kwlug-disc] Hash functions.

John Van Ostrand john at netdirect.ca
Sun Jan 2 12:36:07 EST 2011


----- Original Message -----
> Yes.. thank you CRC is exactly what I'm looking for.

Keep in mind that a CRC will not guarantee uniqueness, there may be two messages that generate the same CRC. In cases like yours I'd look for things that naturally make it unique. If you have the phone number of the SMS source and the date/time in seconds or microseconds, that alone could make a unique number. Reduce the size by doing some coding with the numbers, "pack digits" or convert the phone number to an integer and the date/time to another. A final check to see if there was a duplicate message in the last second and few bits for a count and you should have uniqueness.

For something a little different than that try a GUID or UUID. You should be able to find a function to generate one. The number is so large that randomly generating GUID should not result in a duplicate GUID for a long time.

Also mentioned was predictabilty. If there is a chance predicable IDs could result in a security issue you should go with GUIDs.

-- 
John Van Ostrand 
CTO, co-CEO 
Net Direct Inc. 
564 Weber St. N. Unit 12, Waterloo, ON N2L 5C6 
Ph: 866-883-1172 x5102 
Fx: 519-883-8533 

Linux Solutions / IBM Hardware 





More information about the kwlug-disc mailing list