diff options
author | Karel Zak | 2018-08-31 12:27:32 +0200 |
---|---|---|
committer | Karel Zak | 2018-08-31 12:43:17 +0200 |
commit | d6ddf07d31dfdc894eb8e7e6842aa856342c526e (patch) | |
tree | a498e9dfeac43c6e48716caad52a391e6b92dfbb /login-utils | |
parent | libuuid: add note about RFC4122 UUID layout (diff) | |
download | kernel-qcow2-util-linux-d6ddf07d31dfdc894eb8e7e6842aa856342c526e.tar.gz kernel-qcow2-util-linux-d6ddf07d31dfdc894eb8e7e6842aa856342c526e.tar.xz kernel-qcow2-util-linux-d6ddf07d31dfdc894eb8e7e6842aa856342c526e.zip |
libuuid: fix name-based UUIDs
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: https://github.com/karelzak/util-linux/issues/683
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils')
0 files changed, 0 insertions, 0 deletions