diff --git a/README.md b/README.md index 3df33d6..4ae7bd0 100644 --- a/README.md +++ b/README.md @@ -7,22 +7,17 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/gofrs/uuid)](https://goreportcard.com/report/github.com/gofrs/uuid) Package uuid provides a pure Go implementation of Universally Unique Identifiers -(UUID) variant as defined in RFC-4122. This package supports both the creation +(UUID) variant as defined in RFC-9562. This package supports both the creation and parsing of UUIDs in different formats. This package supports the following UUID versions: -* Version 1, based on timestamp and MAC address (RFC-4122) -* Version 3, based on MD5 hashing of a named value (RFC-4122) -* Version 4, based on random numbers (RFC-4122) -* Version 5, based on SHA-1 hashing of a named value (RFC-4122) -This package also supports experimental Universally Unique Identifier implementations based on a -[draft RFC](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html) that updates RFC-4122 -* Version 6, a k-sortable id based on timestamp, and field-compatible with v1 (draft-peabody-dispatch-new-uuid-format, RFC-4122) -* Version 7, a k-sortable id based on timestamp (draft-peabody-dispatch-new-uuid-format, RFC-4122) - -The v6 and v7 IDs are **not** considered a part of the stable API, and may be subject to behavior or API changes as part of minor releases -to this package. They will be updated as the draft RFC changes, and will become stable if and when the draft RFC is accepted. +* Version 1, based on timestamp and MAC address +* Version 3, based on MD5 hashing of a named value +* Version 4, based on random numbers +* Version 5, based on SHA-1 hashing of a named value +* Version 6, a k-sortable id based on timestamp, and field-compatible with v1 +* Version 7, a k-sortable id based on timestamp ## Project History @@ -50,7 +45,7 @@ deficiencies. ## Requirements -This package requires Go 1.17 or later +This package requires Go 1.19 or later ## Usage @@ -90,6 +85,5 @@ func main() { ## References -* [RFC-4122](https://tools.ietf.org/html/rfc4122) +* [RFC-9562](https://tools.ietf.org/html/rfc9563) (replaces RFC-4122) * [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) -* [New UUID Formats RFC Draft (Peabody) Rev 04](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#) diff --git a/generator.go b/generator.go index 44be9e1..461322a 100644 --- a/generator.go +++ b/generator.go @@ -70,24 +70,12 @@ func NewV5(ns UUID, name string) UUID { // NewV6 returns a k-sortable UUID based on a timestamp and 48 bits of // pseudorandom data. The timestamp in a V6 UUID is the same as V1, with the bit // order being adjusted to allow the UUID to be k-sortable. -// -// This is implemented based on revision 03 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. func NewV6() (UUID, error) { return DefaultGenerator.NewV6() } // NewV7 returns a k-sortable UUID based on the current millisecond precision // UNIX epoch and 74 bits of pseudorandom data. It supports single-node batch generation (multiple UUIDs in the same timestamp) with a Monotonic Random counter. -// -// This is implemented based on revision 04 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. func NewV7() (UUID, error) { return DefaultGenerator.NewV7() } @@ -103,7 +91,7 @@ type Generator interface { } // Gen is a reference UUID generator based on the specifications laid out in -// RFC-4122 and DCE 1.1: Authentication and Security Services. This type +// RFC-9562 and DCE 1.1: Authentication and Security Services. This type // satisfies the Generator interface as defined in this package. // // For consumers who are generating V1 UUIDs, but don't want to expose the MAC @@ -242,7 +230,7 @@ func (g *Gen) NewV1() (UUID, error) { copy(u[10:], hardwareAddr) u.SetVersion(V1) - u.SetVariant(VariantRFC4122) + u.SetVariant(VariantRFC9562) return u, nil } @@ -251,7 +239,7 @@ func (g *Gen) NewV1() (UUID, error) { func (g *Gen) NewV3(ns UUID, name string) UUID { u := newFromHash(md5.New(), ns, name) u.SetVersion(V3) - u.SetVariant(VariantRFC4122) + u.SetVariant(VariantRFC9562) return u } @@ -263,7 +251,7 @@ func (g *Gen) NewV4() (UUID, error) { return Nil, err } u.SetVersion(V4) - u.SetVariant(VariantRFC4122) + u.SetVariant(VariantRFC9562) return u, nil } @@ -272,7 +260,7 @@ func (g *Gen) NewV4() (UUID, error) { func (g *Gen) NewV5(ns UUID, name string) UUID { u := newFromHash(sha1.New(), ns, name) u.SetVersion(V5) - u.SetVariant(VariantRFC4122) + u.SetVariant(VariantRFC9562) return u } @@ -280,20 +268,22 @@ func (g *Gen) NewV5(ns UUID, name string) UUID { // NewV6 returns a k-sortable UUID based on a timestamp and 48 bits of // pseudorandom data. The timestamp in a V6 UUID is the same as V1, with the bit // order being adjusted to allow the UUID to be k-sortable. -// -// This is implemented based on revision 03 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. func (g *Gen) NewV6() (UUID, error) { + /* https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-6 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | time_high | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | time_mid | ver | time_low | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |var| clock_seq | node | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | node | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ var u UUID - if _, err := io.ReadFull(g.rand, u[10:]); err != nil { - return Nil, err - } - - timeNow, clockSeq, err := g.getClockSequence(false) + timeNow, _, err := g.getClockSequence(false) if err != nil { return Nil, err } @@ -301,63 +291,28 @@ func (g *Gen) NewV6() (UUID, error) { binary.BigEndian.PutUint32(u[0:], uint32(timeNow>>28)) // set time_high binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>12)) // set time_mid binary.BigEndian.PutUint16(u[6:], uint16(timeNow&0xfff)) // set time_low (minus four version bits) - binary.BigEndian.PutUint16(u[8:], clockSeq&0x3fff) // set clk_seq_hi_res (minus two variant bits) - - u.SetVersion(V6) - u.SetVariant(VariantRFC4122) - - return u, nil -} -// getClockSequence returns the epoch and clock sequence for V1,V6 and V7 UUIDs. -// -// When useUnixTSMs is false, it uses the Coordinated Universal Time (UTC) as a count of 100- -// -// nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar). -func (g *Gen) getClockSequence(useUnixTSMs bool) (uint64, uint16, error) { - var err error - g.clockSequenceOnce.Do(func() { - buf := make([]byte, 2) - if _, err = io.ReadFull(g.rand, buf); err != nil { - return - } - g.clockSequence = binary.BigEndian.Uint16(buf) - }) - if err != nil { - return 0, 0, err + // Based on the RFC 9562 recommendation that this data be fully random and not a monotonic counter, + //we do NOT support batching version 6 UUIDs. + //set clock_seq (14 bits) and node (48 bits) pseudo-random bits (first 2 bits will be overridden) + if _, err = io.ReadFull(g.rand, u[8:]); err != nil { + return Nil, err } - g.storageMutex.Lock() - defer g.storageMutex.Unlock() + u.SetVersion(V6) - var timeNow uint64 - if useUnixTSMs { - timeNow = uint64(g.epochFunc().UnixMilli()) - } else { - timeNow = g.getEpoch() - } - // Clock didn't change since last UUID generation. - // Should increase clock sequence. - if timeNow <= g.lastTime { - g.clockSequence++ - } - g.lastTime = timeNow + //overwrite first 2 bits of byte[8] for the variant + u.SetVariant(VariantRFC9562) - return timeNow, g.clockSequence, nil + return u, nil } // NewV7 returns a k-sortable UUID based on the current millisecond precision // UNIX epoch and 74 bits of pseudorandom data. -// -// This is implemented based on revision 04 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. func (g *Gen) NewV7() (UUID, error) { var u UUID - /* https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#name-uuid-version-7 - 0 1 2 3 + /* https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-7 + 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | unix_ts_ms | @@ -381,9 +336,11 @@ func (g *Gen) NewV7() (UUID, error) { u[4] = byte(ms >> 8) u[5] = byte(ms) - //support batching by using a monotonic pseudo-random sequence + //Support batching by using a monotonic pseudo-random sequence, + //as described in RFC 9562 section 6.2, Method 1. //The 6th byte contains the version and partially rand_a data. - //We will lose the most significant bites from the clockSeq (with SetVersion), but it is ok, we need the least significant that contains the counter to ensure the monotonic property + //We will lose the most significant bites from the clockSeq (with SetVersion), but it is ok, + //we need the least significant that contains the counter to ensure the monotonic property binary.BigEndian.PutUint16(u[6:8], clockSeq) // set rand_a with clock seq which is random and monotonic //override first 4bits of u[6]. @@ -394,11 +351,48 @@ func (g *Gen) NewV7() (UUID, error) { return Nil, err } //override first 2 bits of byte[8] for the variant - u.SetVariant(VariantRFC4122) + u.SetVariant(VariantRFC9562) return u, nil } +// getClockSequence returns the epoch and clock sequence for V1,V6 and V7 UUIDs. +// +// When useUnixTSMs is false, it uses the Coordinated Universal Time (UTC) as a count of 100- +// +// nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar). +func (g *Gen) getClockSequence(useUnixTSMs bool) (uint64, uint16, error) { + var err error + g.clockSequenceOnce.Do(func() { + buf := make([]byte, 2) + if _, err = io.ReadFull(g.rand, buf); err != nil { + return + } + g.clockSequence = binary.BigEndian.Uint16(buf) + }) + if err != nil { + return 0, 0, err + } + + g.storageMutex.Lock() + defer g.storageMutex.Unlock() + + var timeNow uint64 + if useUnixTSMs { + timeNow = uint64(g.epochFunc().UnixMilli()) + } else { + timeNow = g.getEpoch() + } + // Clock didn't change since last UUID generation. + // Should increase clock sequence. + if timeNow <= g.lastTime { + g.clockSequence++ + } + g.lastTime = timeNow + + return timeNow, g.clockSequence, nil +} + // Returns the hardware address. func (g *Gen) getHardwareAddr() ([]byte, error) { var err error @@ -414,7 +408,7 @@ func (g *Gen) getHardwareAddr() ([]byte, error) { if _, err = io.ReadFull(g.rand, g.hardwareAddr[:]); err != nil { return } - // Set multicast bit as recommended by RFC-4122 + // Set multicast bit as recommended by RFC-9562 g.hardwareAddr[0] |= 0x01 }) if err != nil { diff --git a/generator_test.go b/generator_test.go index 934925a..70719e4 100644 --- a/generator_test.go +++ b/generator_test.go @@ -92,7 +92,7 @@ func testNewV1Basic(t *testing.T) { if got, want := u.Version(), V1; got != want { t.Errorf("generated UUID with version %d, want %d", got, want) } - if got, want := u.Variant(), VariantRFC4122; got != want { + if got, want := u.Variant(), VariantRFC9562; got != want { t.Errorf("generated UUID with variant %d, want %d", got, want) } } @@ -110,7 +110,7 @@ func testNewV1BasicWithOptions(t *testing.T) { if got, want := u.Version(), V1; got != want { t.Errorf("generated UUID with version %d, want %d", got, want) } - if got, want := u.Variant(), VariantRFC4122; got != want { + if got, want := u.Variant(), VariantRFC9562; got != want { t.Errorf("generated UUID with variant %d, want %d", got, want) } } @@ -249,7 +249,7 @@ func testNewV3Basic(t *testing.T) { if got, want := u.Version(), V3; got != want { t.Errorf("NewV3(%v, %q): got version %d, want %d", ns, name, got, want) } - if got, want := u.Variant(), VariantRFC4122; got != want { + if got, want := u.Variant(), VariantRFC9562; got != want { t.Errorf("NewV3(%v, %q): got variant %d, want %d", ns, name, got, want) } want := "5df41881-3aed-3515-88a7-2f4a814cf09e" @@ -296,7 +296,7 @@ func testNewV4Basic(t *testing.T) { if got, want := u.Version(), V4; got != want { t.Errorf("got version %d, want %d", got, want) } - if got, want := u.Variant(), VariantRFC4122; got != want { + if got, want := u.Variant(), VariantRFC9562; got != want { t.Errorf("got variant %d, want %d", got, want) } } @@ -383,7 +383,7 @@ func testNewV5Basic(t *testing.T) { if got, want := u.Version(), V5; got != want { t.Errorf("NewV5(%v, %q): got version %d, want %d", ns, name, got, want) } - if got, want := u.Variant(), VariantRFC4122; got != want { + if got, want := u.Variant(), VariantRFC9562; got != want { t.Errorf("NewV5(%v, %q): got variant %d, want %d", ns, name, got, want) } want := "2ed6657d-e927-568b-95e1-2665a8aea6a2" @@ -433,7 +433,7 @@ func testNewV6Basic(t *testing.T) { if got, want := u.Version(), V6; got != want { t.Errorf("generated UUID with version %d, want %d", got, want) } - if got, want := u.Variant(), VariantRFC4122; got != want { + if got, want := u.Variant(), VariantRFC9562; got != want { t.Errorf("generated UUID with variant %d, want %d", got, want) } } @@ -624,7 +624,7 @@ func makeTestNewV7Basic() func(t *testing.T) { if got, want := u.Version(), V7; got != want { t.Errorf("got version %d, want %d", got, want) } - if got, want := u.Variant(), VariantRFC4122; got != want { + if got, want := u.Variant(), VariantRFC9562; got != want { t.Errorf("got variant %d, want %d", got, want) } } @@ -652,7 +652,7 @@ func makeTestNewV7TestVector() func(t *testing.T) { if got, want := u.Version(), V7; got != want { t.Errorf("got version %d, want %d", got, want) } - if got, want := u.Variant(), VariantRFC4122; got != want { + if got, want := u.Variant(), VariantRFC9562; got != want { t.Errorf("got variant %d, want %d", got, want) } if got, want := u.String()[:15], "017f22e2-79b0-7"; got != want { @@ -677,7 +677,7 @@ func makeTestNewV7Basic10000000() func(t *testing.T) { if got, want := u.Version(), V7; got != want { t.Errorf("got version %d, want %d", got, want) } - if got, want := u.Variant(), VariantRFC4122; got != want { + if got, want := u.Variant(), VariantRFC9562; got != want { t.Errorf("got variant %d, want %d", got, want) } } diff --git a/uuid.go b/uuid.go index 032719c..8ad7642 100644 --- a/uuid.go +++ b/uuid.go @@ -20,24 +20,21 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // Package uuid provides implementations of the Universally Unique Identifier -// (UUID), as specified in RFC-4122 and the Peabody RFC Draft (revision 03). +// (UUID), as specified in RFC-9562 (formerly RFC-4122). // -// RFC-4122[1] provides the specification for versions 1, 3, 4, and 5. The -// Peabody UUID RFC Draft[2] provides the specification for the new k-sortable -// UUIDs, versions 6 and 7. +// RFC-9562[1] provides the specification for versions 1, 3, 4, 5, 6 and 7. // -// DCE 1.1[3] provides the specification for version 2, but version 2 support +// DCE 1.1[2] provides the specification for version 2, but version 2 support // was removed from this package in v4 due to some concerns with the // specification itself. Reading the spec, it seems that it would result in // generating UUIDs that aren't very unique. In having read the spec it seemed // that our implementation did not meet the spec. It also seems to be at-odds -// with RFC 4122, meaning we would need quite a bit of special code to support +// with RFC 9562, meaning we would need quite a bit of special code to support // it. Lastly, there were no Version 2 implementations that we could find to // ensure we were understanding the specification correctly. // -// [1] https://tools.ietf.org/html/rfc4122 -// [2] https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03 -// [3] http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01 +// [1] https://tools.ietf.org/html/rfc9562 +// [2] http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01 package uuid import ( @@ -50,7 +47,7 @@ import ( // Size of a UUID in bytes. const Size = 16 -// UUID is an array type to represent the value of a UUID, as defined in RFC-4122. +// UUID is an array type to represent the value of a UUID, as defined in RFC-9562. type UUID [Size]byte // UUID versions. @@ -61,19 +58,22 @@ const ( V3 // Version 3 (namespace name-based) V4 // Version 4 (random) V5 // Version 5 (namespace name-based) - V6 // Version 6 (k-sortable timestamp and random data, field-compatible with v1) [peabody draft] - V7 // Version 7 (k-sortable timestamp and random data) [peabody draft] - _ // Version 8 (k-sortable timestamp, meant for custom implementations) [peabody draft] [not implemented] + V6 // Version 6 (k-sortable timestamp and random data, field-compatible with v1) + V7 // Version 7 (k-sortable timestamp and random data) + _ // Version 8 (k-sortable timestamp, meant for custom implementations) [not implemented] ) // UUID layout variants. const ( VariantNCS byte = iota - VariantRFC4122 + VariantRFC9562 VariantMicrosoft VariantFuture ) +// Backward-compatible variant for RFC 4122 +const VariantRFC4122 = VariantRFC9562 + // UUID DCE domains. const ( DomainPerson = iota @@ -113,12 +113,6 @@ func TimestampFromV1(u UUID) (Timestamp, error) { // TimestampFromV6 returns the Timestamp embedded within a V6 UUID. This // function returns an error if the UUID is any version other than 6. -// -// This is implemented based on revision 03 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. func TimestampFromV6(u UUID) (Timestamp, error) { if u.Version() != 6 { return 0, fmt.Errorf("uuid: %s is version %d, not version 6", u, u.Version()) @@ -133,12 +127,6 @@ func TimestampFromV6(u UUID) (Timestamp, error) { // TimestampFromV7 returns the Timestamp embedded within a V7 UUID. This // function returns an error if the UUID is any version other than 7. -// -// This is implemented based on revision 03 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. func TimestampFromV7(u UUID) (Timestamp, error) { if u.Version() != 7 { return 0, fmt.Errorf("uuid: %s is version %d, not version 7", u, u.Version()) @@ -157,12 +145,12 @@ func TimestampFromV7(u UUID) (Timestamp, error) { return Timestamp(tsNanos), nil } -// Nil is the nil UUID, as specified in RFC-4122, that has all 128 bits set to +// Nil is the nil UUID, as specified in RFC-9562, that has all 128 bits set to // zero. var Nil = UUID{} -// Max is the maximum UUID, as specified in a draft of RFC-4122, that has all 128 bits -// set to one. This feature is subject to removal if it is removed from the final draft of the RFC. +// Max is the maximum UUID, as specified in RFC-9562, that has all 128 bits +// set to one. var Max = UUID{ 0xFF, 0xFF, @@ -206,7 +194,7 @@ func (u UUID) Variant() byte { case (u[8] >> 7) == 0x00: return VariantNCS case (u[8] >> 6) == 0x02: - return VariantRFC4122 + return VariantRFC9562 case (u[8] >> 5) == 0x06: return VariantMicrosoft case (u[8] >> 5) == 0x07: @@ -221,7 +209,7 @@ func (u UUID) Bytes() []byte { return u[:] } -// encodeCanonical encodes the canonical RFC-4122 form of UUID u into the +// encodeCanonical encodes the canonical RFC-9562 form of UUID u into the // first 36 bytes dst. func encodeCanonical(dst []byte, u UUID) { const hextable = "0123456789abcdef" @@ -242,7 +230,7 @@ func encodeCanonical(dst []byte, u UUID) { } } -// String returns a canonical RFC-4122 string representation of the UUID: +// String returns a canonical RFC-9562 string representation of the UUID: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. func (u UUID) String() string { var buf [36]byte @@ -254,8 +242,8 @@ func (u UUID) String() string { // // The behavior is as follows: // The 'x' and 'X' verbs output only the hex digits of the UUID, using a-f for 'x' and A-F for 'X'. -// The 'v', '+v', 's' and 'q' verbs return the canonical RFC-4122 string representation. -// The 'S' verb returns the RFC-4122 format, but with capital hex digits. +// The 'v', '+v', 's' and 'q' verbs return the canonical RFC-9562 string representation. +// The 'S' verb returns the RFC-9562 format, but with capital hex digits. // The '#v' verb returns the "Go syntax" representation, which is a 16 byte array initializer. // All other verbs not handled directly by the fmt package (like '%p') are unsupported and will return // "%!verb(uuid.UUID=value)" as recommended by the fmt package. @@ -308,7 +296,7 @@ func (u *UUID) SetVariant(v byte) { switch v { case VariantNCS: u[8] = (u[8]&(0xff>>1) | (0x00 << 7)) - case VariantRFC4122: + case VariantRFC9562: u[8] = (u[8]&(0xff>>2) | (0x02 << 6)) case VariantMicrosoft: u[8] = (u[8]&(0xff>>3) | (0x06 << 5)) diff --git a/uuid_test.go b/uuid_test.go index 941d8ca..6dc97f9 100644 --- a/uuid_test.go +++ b/uuid_test.go @@ -83,7 +83,7 @@ func testUUIDVariant(t *testing.T) { }, { u: UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - want: VariantRFC4122, + want: VariantRFC9562, }, { u: UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, @@ -113,7 +113,7 @@ func testUUIDSetVersion(t *testing.T) { func testUUIDSetVariant(t *testing.T) { variants := []byte{ VariantNCS, - VariantRFC4122, + VariantRFC9562, VariantMicrosoft, VariantFuture, }