doc.odin 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. Universally Unique Identifiers (`UUID`) according to [[ RFC 4122 ; https://tools.ietf.org/html/rfc4122.html ]], with additions from [[ RFC 9562 ; https://tools.ietf.org/html/rfc9562.html ]].
  3. The UUIDs are textually represented and read in the following string format:
  4. `00000000-0000-v000-V000-000000000000`
  5. `v` is where the version bits reside, and `V` is where the variant bits reside.
  6. The meaning of the other bits is version-dependent.
  7. Outside of string representations, UUIDs are represented in memory by a 128-bit
  8. structure organized as an array of 16 bytes.
  9. Of the UUID versions which may make use of random number generation, a
  10. requirement is placed upon them that the underlying generator be
  11. cryptographically-secure, per RFC 9562's suggestion.
  12. - Version 1 without a node argument.
  13. - Version 4 in all cases.
  14. - Version 6 without either a clock or node argument.
  15. - Version 7 in all cases.
  16. Example:
  17. package main
  18. import "core:crypto"
  19. import "core:encoding/uuid"
  20. main :: proc() {
  21. my_uuid: uuid.Identifier
  22. {
  23. // This scope will have a CSPRNG.
  24. context.random_generator = crypto.random_generator()
  25. my_uuid = uuid.generate_v7()
  26. }
  27. // Back to the default random number generator.
  28. }
  29. For more information on the specifications, see here:
  30. - [[ https://www.rfc-editor.org/rfc/rfc4122.html ]]
  31. - [[ https://www.rfc-editor.org/rfc/rfc9562.html ]]
  32. */
  33. package uuid