Search code examples
uuidguiduniqueidentifier

8 character length UUID


I'm making ticket system and would want to know generate random 8 character length UUID. I've searched a bit and found that UUID has types between 1-4.

Mu questions

  1. How unique is type 1 UUID?
  2. Should I generate type 4 UUID and get first 8 character?
  3. Should I use UUID for generate 8 character length unique id?

Solution

  • A UUID is 128 bits, commonly displayed as a 36-byte hexadecimal string. If you throw away some (in your case, most) of the bits, it is no longer a UUID.

    If you just want 8 random bytes, use your language's native function to generate that.