Reputation: 86967
Given that GUID's
are (more or less) unique, if we shorten it with some code which:
It basically just converts a GUID into a base64 string and shortens it a bit. It takes a standard GUID like this:
c9a646d3-9c61-4cb7-bfcd-ee2522c8f633
And converts it into this smaller string:
00amyWGct0y_ze4lIsj2Mw
Can I now assume that the shortened guid is equally as unique as it's previous (normal) form?
Upvotes: 3
Views: 110
Reputation: 240010
This is a reversable transform — you can get the original GUID back with an inverse function. That means that it's exactly as "unique"; there's a different "shortened GUID" for every GUID. The final substr
step in the encode function is removing the base64 padding characters ==
. This doesn't lose any information because every GUID is the same length and therefore every GUID has the same padding. The decode function re-appends "=="
before passing to the base64 decoder.
Upvotes: 6