This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: uuid module generates incorrect values for uuid3 (and possibly uuid5)
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, dsm001, pwr
Priority: normal Keywords:

Created on 2009-03-04 07:28 by pwr, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg83118 - (view) Author: René Puls (pwr) Date: 2009-03-04 07:28
I am trying to recreate the sample output from appendix B of RFC 4122.

http://www.ietf.org/rfc/rfc4122.txt

In that document, a version 3 UUID is created using the DNS namespace 
(6ba7b810-9dad-11d1-80b4-00c04fd430c8, same as uuid.NAMESPACE_DNS in 
Python) and the name 'www.widgets.com'.

The result according to the RFC should be:

e902893a-9d22-3c7e-a7b8-d6e313b71d9f

Here is the output from the Python uuid module:

>>> import uuid
>>> uuid.NAMESPACE_DNS
UUID('6ba7b810-9dad-11d1-80b4-00c04fd430c8')
>>> uuid.uuid3(uuid.NAMESPACE_DNS, 'www.widgets.com')
UUID('3d813cbb-47fb-32ba-91df-831e1593ac29')

I couldn't find any test cases for the Python module. Did I use it 
incorrectly, or is the calculation really off?
msg83290 - (view) Author: DSM (dsm001) Date: 2009-03-07 22:39
Hmm.  I quickly wrote my own implementation and I agree with the uuid
module and disagree with the RFC value.  

Further searching suggests that this may be an error in the RFC.  See
http://www.rfc-editor.org/errata_search.php?rfc=4122 ; see also 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5064537 for a
specific explanation of what probably caused the bug in the reference code.

I can reproduce the RFC value by (IMO incorrectly) flipping the
namespace endianness.

(It may be worth noting, though, that one of the links above points to
the python implementation for support-- so there could be a vicious
circle here. :^)
msg89986 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-07-01 15:57
I also found several threads saying that the RFC is wrong;
the current uuid.py module returns the correct result.
History
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49665
2009-07-01 15:57:13amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg89986

resolution: works for me
2009-03-07 22:39:38dsm001setnosy: + dsm001
messages: + msg83290
2009-03-04 07:28:58pwrcreate