google / google/uuid

Incorrect uuidv6 implementation

Open
#159 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
6.1k
Forks
440
PR merge metrics
No merged PRs in 30d

Description

[RFC 4122](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#appendix-B.1) UUIDv6 Example: **1EC9414C-232A-6B00-B3C8-9E6BDECED846**
But in this library **NewV6** generates ID like: **01eee693-1887-6e10-a722-9e6bdeced846** has a prefix 0

Many UUID libraries in other languages (for example [python uuid6](https://pypi.org/project/uuid6/)) follow the instructions of the RFC.

For UUIDv6, RFC also mentioned
> The 48 bit node **SHOULD** be set to a pseudo-random value however implementations **MAY** choose to retain the old MAC address behavior from [[RFC4122](https://www.rfc-editor.org/info/rfc4122)], [Section 4.1.6](https://rfc-editor.org/rfc/rfc4122#section-4.1.6) and [[RFC4122](https://www.rfc-editor.org/info/rfc4122)], [Section 4.5](https://rfc-editor.org/rfc/rfc4122#section-4.5). For more information on MAC address usage within UUIDs see the [Section 8](https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#Security)

The last 48bit node can set to a pseudo-random value, it maybe more useful.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.