views:

184

answers:

7

I am using UUIDs, but they are not particularly nice to read, write and communicate. So I would like to encode them. I could use base64, or base32, but they would not be easy anyway: base64 has capitalized letters and symbols. Base32 is a bit better, but you can still obtain clumsy stuff.

I was wondering if there's a nice and clean way to encode a number into palatable phonemes, so to achieve better readability and hopefully a bit of compression.

A: 

If they were easy to read they probably wouldn't be particularly unique.

Azeem.Butt
That's not true. A UUID is just a large number. It's how you encode it that makes the difference.
Stefano Borini
This seems like a reasonable statement: the set of pronounceable objects **is** probably less than the set of unique numbers.
pavium
If you know that it's not true then why haven't you solved your own problem?
Azeem.Butt
the set of characters from 0 to f is probably less than the set of unique numbers. Still you see uuid encoded in hex and I can guarantee you they are very unique.
Stefano Borini
+7  A: 

I hope you don't use this idea: The Automated Curse Generator :)

Michał Niklas
I hope that you do!
Soldier.moth
This is fantastic. I cannot really say you solved my question, but definitely you provided an interesting point of view. +1
Stefano Borini
+2  A: 

Why not use something similar to what PGP does to create readable keys, simply find a nice list of words that are distinctive, lets say you're using 128 bit UUID's, a list of 256 words (2^8) means 16 words.

Stupid question but why are people reading/writing UUID's/etc. with respect to your application?

Kurt
I need to generate unique ids, because I am going to perform merging in the future. However, the objects I create are identified by URIs what contain the uuid. Of course I can assign more meaningful names, but I cannot expect every object I create to have a meaningful name. Still, I'd like to have something that can be spelled out.
Stefano Borini
Your idea is interesting. I think that using full words is a bit overkill, but I like it. Looking for something shorter though.
Stefano Borini
Then I would just go with hex encoding, 0-9, a-f, most people can read/pronounce those without to much trouble.
Kurt
+3  A: 

Bubble Babble is a good bet.

A: 

and hopefully a bit of compression

Not sure exactly what you mean there; making something "readable" or "pronouncable" will inevitably expand the space required for it. Maybe you meant "hopefully a bit of redundancy"? It would be good if, even if the user makes a small mistake, the system can detect and perhaps even correct it.

Really it depends very much on how big your UUIDs are and how they are most often communicated. If they need to be communicated over phone or VoIP, you want more audible redundancy. If they need to be entered into mobile devices with numeric keypads, it tends to be difficult to enter alphabetic characters, moreso if they are case-sensitive. If they are written down a lot, you need to worry about characters that look similar (O and 0 and o, for instance). If they need to be memorised, then probably strings of real words are the best (have a look at the PGP Word List).

However I think a great all-round solution is just using numberic digits. They're a lot harder to confuse with each other (both when spoken and written) than some alphabetic characters. Easy to enter on mobile devices, and people aren't too bad at memorising numbers.

And the length of the string is not too bad either. Let's compare base32 with base 10 (decimal). The length of a decimal string is log_10(32) times the length of the corresponding base32 string, or about 1.5 times as long. Ten characters of base32 correspond to 15 decimal digits.

Not much of a penalty, IMO, seeing as in base 32 it's easy to confuse C and T, or S, F and X (when spoken), and someone speaking with a foreign accent is more likely to cause trouble.

Artelius
What I mean is that, for example, the sequence from 00 to FF is in base 16. If you accept tokens like "wa" or "su" or "me", you have more flexibility and consequently it takes less space. For example, a UUID encoded in base64 takes only 22 characters, and 26 in base32.
Stefano Borini
So, you're looking for a reasonably space- or time-efficient (not necessarily for a computer, maybe for a person) means of representing UUIDs. I've revised my answer to further discuss why I think KISS (and use decimal) is often the best way to go.
Artelius
If you're using long strings of digits PLEASE put a dash in every 4 characters so that people can use their well trained short memory (credit card #'s, phone #'s) to read digits in groupings of 4.
Kurt
I agree with Kurt on that!
Artelius
+1  A: 

S/KEY uses a dictionary of 2048 words to map 64 bit numbers to a sequence of 6 predefined words/syllables. (People will always find swear words if they are looking for them ;) )

devio
+1  A: 

If all you want is a way to communicate hex values readably (ie, over the phone, or when instructing someone verbally what to type), then I suggest you use one of the various phonetic alphabets, such as the NATO Phonetic Alphabet or the US Army/Navy Phonetic Alphabet.

In the latter, the letters A-F are spoken as "able", "baker", "charlie", "dog", "easy", and "fox", respectively, so you would read the hex sequence "3fd2cc0e" as "three fox dog two charlie charlie zero easy". A uuid would be read out in exactly the same fashion.

Dale Hagglund