diff --git a/doc.go b/doc.go index 5b8a4b9..6c2ab76 100644 --- a/doc.go +++ b/doc.go @@ -4,7 +4,7 @@ // Package uuid generates and inspects UUIDs. // -// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security +// UUIDs are based on RFC 9562(obsoletes RFC 4122) and DCE 1.1: Authentication and Security // Services. // // A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to diff --git a/hash.go b/hash.go index 35338cd..d3bc00a 100644 --- a/hash.go +++ b/hash.go @@ -38,7 +38,7 @@ func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { var uuid UUID copy(uuid[:], s) uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) - uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant + uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 9562 variant return uuid } diff --git a/uuid.go b/uuid.go index 5232b48..b745bac 100644 --- a/uuid.go +++ b/uuid.go @@ -16,7 +16,7 @@ import ( ) // A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC -// 4122. +// 9562. type UUID [16]byte // A Version represents a UUID's version. @@ -28,12 +28,17 @@ type Variant byte // Constants returned by Variant. const ( Invalid = Variant(iota) // Invalid UUID - RFC4122 // The variant specified in RFC4122 + RFC4122 // The variant specified in RFC9562(obsoletes RFC4122). Reserved // Reserved, NCS backward compatibility. Microsoft // Reserved, Microsoft Corporation backward compatibility. Future // Reserved for future definition. ) +// RFC9562 added V6 and V7 of UUID, but did not change specification of V1 and V4 +// implemented in this module. To avoid creating new major module version, +// we still use RFC4122 for constant name. +const Standard = RFC4122 + const randPoolSize = 16 * 16 var ( @@ -57,7 +62,7 @@ func IsInvalidLengthError(err error) bool { } // Parse decodes s into a UUID or returns an error if it cannot be parsed. Both -// the standard UUID forms defined in RFC 4122 +// the standard UUID forms defined in RFC 9562 // (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) are decoded. In addition, // Parse accepts non-standard strings such as the raw hex encoding