[Yanel-dev] Unique IDs

Nigel Runnels-Moss n.runnels-moss at sourcesense.com
Wed Jan 12 15:38:18 CET 2011


Encoding, yes; I was referring to shortening of the type described in the
thread before, namely:

I see that UUID has also other methods, e.g.:
UUID.randomUUID().getLeastSignificantBits() --> 6174657925133947722 (64
Bits)
UUID.randomUUID().getMostSignificantBits() --> 5706839542716611039 (64 Bits)

Which is quite different to what you are proposing by switching from base16
to base64...

N.

On Wed, Jan 12, 2011 at 2:16 PM, Cedric Staub <cedric.staub at wyona.com>wrote:

> On Wed, Jan 12, 2011 at 01:29:12PM +0000, Nigel Runnels-Moss wrote:
> > There are issues with UUID shortening, not least of which they cease to
> > become unique...
>
> Actually you can make UUIDs shorter while still preserving the full set
> of information by simply switching to a higher-base encoding. Normally a
> UUID is encoded with base 16 (hex), but that can easily be changed ;-).
>
> If you use e.g. 64 characters you can do a base 64 encoding, where each
> character would represent 6 bits of information as opposed to the 4 bits
> of information for each character in a base 16 encoding.
>
> Since UUIDs carry 128 bits of information switching from a base 16 to a
> base 64 encoding would allow one to shorten the length of the encoding
> down to 22 characters instead of the original 32.
>
> Switching to an encoding with an even higher base would allow for an
> even shorter UUID, but it's actually quite difficult to find more than
> 64 printable ASCII characters. There's an implementation of an encoding
> that uses 85 characters to achieve a base 85 encoding, but it is very
> human-unfriendly because it starts to include funny characters. However,
> it would allow one to cut down the size of the UUID to 20 characters.
>
> Cheers
> Cedric
> --
> Yanel-development mailing list Yanel-development at wyona.com
> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wyona.org/pipermail/yanel-development/attachments/2011011=
2/9e099aef/attachment.htm


More information about the Yanel-development mailing list