doc.odin 1.3 KB

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