Warm tip: This article is reproduced from serverfault.com, please click

Generating 8-character only UUIDs

发布于 2010-11-24 13:50:49

UUID libraries generate 32-character UUIDs.

I want to generate 8-character only UUIDs, is it possible?

Questioner
M.J.
Viewed
1
5,903 2017-11-28 18:27:57

It is not possible since a UUID is a 16-byte number per definition. But of course, you can generate 8-character long unique strings (see the other answers).

Also be careful with generating longer UUIDs and substring-ing them, since some parts of the ID may contain fixed bytes (e.g. this is the case with MAC, DCE and MD5 UUIDs).