-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uuidgen, libuuid: UUID v5 not compatible with RFC 4122 #683
Comments
|
@pprindeville any comment? :-) |
karelzak
added a commit
that referenced
this issue
Aug 31, 2018
The current version is not fully compatible with RFC4122. It
incorrectly encodes UUID variant
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
where M is UUID version and N is UUID variant.
$ python -c "import uuid ; print(uuid.uuid5(uuid.UUID(int=0), 'foo'))"
aa752cea-8222-5bc8-acd9-555b090c0ccb
^^
Old version:
$ uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1
aa752cea-8222-5bc8-8cd9-555b090c0ccb
^^
Fixed version:
./uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1;
aa752cea-8222-5bc8-acd9-555b090c0ccb
^^
The patch uses uuid_unpack and uuid_pack. It makes code more readable
and allow to access proper octens. The same way we already use for
time and random based UUIDs.
Addresses: #683
Signed-off-by: Karel Zak <kzak@redhat.com>
|
Fixed. Thanks for your report! |
ramsey
pushed a commit
to ramsey/libuuid
that referenced
this issue
Feb 10, 2020
The current version is not fully compatible with RFC4122. It
incorrectly encodes UUID variant
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
where M is UUID version and N is UUID variant.
$ python -c "import uuid ; print(uuid.uuid5(uuid.UUID(int=0), 'foo'))"
aa752cea-8222-5bc8-acd9-555b090c0ccb
^^
Old version:
$ uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1
aa752cea-8222-5bc8-8cd9-555b090c0ccb
^^
Fixed version:
./uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1;
aa752cea-8222-5bc8-acd9-555b090c0ccb
^^
The patch uses uuid_unpack and uuid_pack. It makes code more readable
and allow to access proper octens. The same way we already use for
time and random based UUIDs.
Addresses: util-linux/util-linux#683
Signed-off-by: Karel Zak <kzak@redhat.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(note
8cd9in uuidgen vsacd9in Python, andecd9in the hash)For a variant mark that takes two bits (http://pubs.opengroup.org/onlinepubs/9629399/apdxa.htm#tagtcjh_36 DCE variant, "most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved" from https://tools.ietf.org/html/rfc4122#section-4.3) uuidgen sets bit 5 to zero too: https://github.com/karelzak/util-linux/blob/917f53cf13c36d32c175f80f2074576595830573/libuuid/src/gen_uuid.c#L608
Line 607 sets 3 MSBs to zero, no matter the size of variant.
Line 608 sets 2 MSBs to 0x4, or 3 MSBs to 0x6 or 0x7.
The text was updated successfully, but these errors were encountered: