I want to write simple regex to validate UUIDs, but I'm not sure about this small detail.
Wikipedia states:
UUID is represented by 32 lowercase hexadecimal digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and four hyphens).
But couldn't find anything like it in RFC spec document.
So the question remains whether this UUID is valid: f47ac10b58cc4372a5670e02b2c3d479
?
Wikipedia states: UUID is represented by 32 lowercase hexadecimal digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and four hyphens).
In UUIDs, that number is 128 bits long and is written in hexadecimal, so unlike a phone number it's less “obviously” a number, but the basic principle is the same. Deleting the dashes won't change the number and thus won't impact security.
As per Wikipedia, the number of UUIDs generated to have atleast 1 collision is 2.71 quintillion.
Universally Unique Identifiers, or UUIDS, are 128 bit numbers, composed of 16 octets and represented as 32 base-16 characters, that can be used to identify information across a computer system. This specification was originally created by Microsoft and standardized by both the IETF and ITU.
The production in RFC 4122 (section 3, page 4), defines UUID string representation as
UUID = time-low "-" time-mid "-"
time-high-and-version "-"
clock-seq-and-reserved
clock-seq-low "-" node
where each internal component is hex-encoded.
Therefore, f47ac10b58cc4372a5670e02b2c3d479
is not a valid UUID representation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With