Is it possible to the Hash or digest of a GUID so it is shorter in length while maintaining it's uniqueness?
Asked
Active
Viewed 902 times
1
-
That depends. How much do you want to shorten it by? – Greg Hewgill Mar 31 '15 at 22:42
-
http://blog.codinghorror.com/equipping-our-ascii-armor/ Also, http://blogs.msdn.com/b/oldnewthing/archive/2008/06/27/8659071.aspx – JLRishe Mar 31 '15 at 22:45
-
And http://stackoverflow.com/questions/8118252/is-there-any-way-to-create-a-short-unique-code-like-short-guid, http://stackoverflow.com/questions/904920/how-short-can-a-guid-be – JLRishe Mar 31 '15 at 22:47
-
@JLRishe: i name you "archivist". – Tim Schmelter Mar 31 '15 at 22:51
-
I never think to check for duplication. Does this mean I should delete my answer? – Dan Field Mar 31 '15 at 22:53
-
@DanField: you can wait until it gets closed. But you should take more time to find the answer on SO before you ask a question. – Tim Schmelter Mar 31 '15 at 22:54
-
I wrote an answer, I didn't write the question. – Dan Field Mar 31 '15 at 22:54
1 Answers
0
No. A GUID needs all 128 bits to be globally unique. The bits describe the time, location, and uniqueness identifier (an incrementing key used to prevent the same GUID from being generated if the clock hasn't moved or has been artificially manipulated).
If you have some requirement short of global uniqueness, then yes, you can create locally unique identifiers that are less than 128 bits. There are likely better ways to do this than generating a 128 bit GUID and then coming up with some kind of awesome hashing algorithm that maintains pretty good uniqueness at less than 128 bits.

Dan Field
- 20,885
- 5
- 55
- 71
-
I don't know if I agree with this answer, but I think I'll code it first. – Eric J. Price Jun 16 '22 at 21:00