2013-10-08

Lowercase UUIDs

The UUID spec requires that hex strings be generated in lowercase, while tolerating uppercase for input.

6.5.4 Software generating the hexadecimal representation of a UUID shall not use upper case letters. NOTE – It is recommended that the hexadecimal representation used in all human-readable formats be restricted to lower-case letters. Software processing this representation is, however, required to accept both upper and lower case letters as specified in 6.5.2.
 Unfortunately, the 'uuidgen' command in Mac OS X is out of compliance with the spec, outputting uppercase. Example:

…$ uuidgen
54B09346-2176-4EF5-AB36-5E8A70D0BC9F


Also, Microsoft utilities in the past have output mixed case, oddly enough (a programing boo-boo according to legend).

This blog post  shares a line of bash code to convert the Mac's hex string to lowercase.
uuidgen | tr [:upper:] [:lower:]

Example:
$ uuidgen | tr [:upper:] [:lower:]
a03959cb-cf12-4de5-89d2-3a3be7963e1c


No comments:

Post a Comment