UUID Introduction
UUID, or Universally Unique Identifier, stands for Universal Unique Identifier.
The format of a UUID is: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx.
- M represents the version number. Since there are five versions in the standard implementation of UUIDs, M ranges from 1 to 5.
- N takes one of the values: 8, 9, a, or b.
UUID Versions
- Version 1: Implements each field's meaning strictly according to the UUID definition. The variable factor used is a combination of timestamp + clock sequence + node information (MAC address). Twitter's Snowflake algorithm can be considered a simplified version of UUID Version 1.
- Version 2: Generally consistent with Version 1, but it is primarily associated with DCE (IBM's Distributed Computing Environment). However, this version is not specifically described in the IETF; instead, its concrete implementation is detailed in the document "DCE 1.1: Authentication and Security Services". Consequently, this version is rarely used today, and many implementations ignore it.
- Version 3: Implements the variable factor based on a hash of name and namespace. Version 3 uses the MD5 algorithm for hashing.
- Version 4: Implements the variable factor using random or pseudo-random methods.
- Version 5: Implements the variable factor based on a hash of name and namespace. Version 5 uses the SHA1 algorithm for hashing.