tag:blogger.com,1999:blog-7625178889455096573.post5609036922522892535..comments2017-06-06T20:38:15.644-05:00Comments on my kingdom for a smile :-): URL-Safe Compressed and Enhanced UUID/GUIDRuss Jacksonhttp://www.blogger.com/profile/15521749913146166813noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-7625178889455096573.post-87620311814651562702017-06-06T20:38:15.644-05:002017-06-06T20:38:15.644-05:00Hi Dominique, that's a great observation and q...Hi Dominique, that's a great observation and question. <br /><br />When you compress the character representation of the GUID down using a base 64 encoding you can get it down to 22 characters. You could then expand that 22 chars back into a 128 bit GUID by reversing the process (you have to drop the last 4 bits, which could have been filled in with meaningless data).<br /><br />But, since a base 64 character requires 6 bits to uniquely represent it, 22 characters can effectively hold 132 bits of numeric data. So, the 22 character base 64 string has 4 extra bits. <br /><br />If you don't plan to reconstitute those 22 chars into a 128 bit number you can use those 4 extra bits to increase the number of unique 22 character strings by a factor of 16. If you don't use those extra bits you can just fill them in with zeros. <br /><br />Look at it this way... <br /><br />32 characters = 256 bits of character data (8 bits per character)<br /><br />But, only half of those bits are used to represent the 128 bit GUID. Each 4 bits of numeric data in the GUID is expanded into 8 bits of character data in the string.<br /><br />Likewise, 22 characters = 132 bits of character data. Of that, with a base 64 encoding, 128 bits of that represents the numeric data. In that very last 6 bit base 64 character only 2 of its bits are being used. There are 4 bits available for actual data. <br /><br />Putting those 4 bits to work by filling them with random data instead of all zeros lets you increase the number of unique 22 character strings by a factor of 16. <br /><br />I hope I was more articulate with this response. Let me know if I didn't clear that up.<br /><br />Thanks.<br /><br />Russ<br /><br /><br /><br /><br /><br />Russ Jacksonhttps://www.blogger.com/profile/15521749913146166813noreply@blogger.comtag:blogger.com,1999:blog-7625178889455096573.post-14931344205307536962017-06-06T14:53:07.487-05:002017-06-06T14:53:07.487-05:00Good Job!!
I'm confused. The compression purpo...Good Job!!<br />I'm confused. The compression purpose is to reduce the number of bits. However, you have GUID with 128bit, after compression you obtain 132 bits, so 4 more bits. I can see the advantage of increasing the number of GUID but What about the compression? It seems like it doesn't help for compression. Am I right? Dominique BAMOUNIhttps://www.blogger.com/profile/16326454531558424703noreply@blogger.com