Brian's Blog

items I see across my tribes

Unique Hash

November 05
by briancarter 5. November 2011 08:51

image_thumb

A hash function that returns a unique hash number/string is called a universal hash function.

Thus, we say that our hash function has the following properties

  • it always returns a value for an object.
  • two equal objects will always have the same value
  • two unequal objects may not always have different values

When we put objects into a hashtable, it is possible that different objects might have the same hashcode. This is called a collision. Here is the example of collision. Two different strings ""Aa" and "BB" have the same key:

"Aa" = 'A' * 31 + 'a' = 2112
"BB" = 'B' * 31 + 'B' = 2112

The problem I’m addressing, given 2 GUIDs, will the hash be unique? More research on my part is required, but I know the probability is extremely low – especially using a unique salt.  I made sure by it was  unique by adding a unique index (constraint) on the hash column in SQL Server (paranoid).

If you have any thoughts on my problem of 2 hashed GUIDS, please let me know.

Thank You for listening!

Categories:


 Questions or Feedback, my contact information is located on my About page.


The opinions, thoughts, and comments made in these blog posts are solely my own (unless otherwise stated). They do not reflect the opinions, thoughts or practices of my employer, my universities, my family, or anyone else. Also, I retain the right to change my mind about anything I publish here without having to go back and edit posts that occurred in the past. 

These are my opinions, or just as likely, someone else's opinions that I leveraged for my own.