diff options
Diffstat (limited to 'indra/lib/python/uuid.py')
-rwxr-xr-x[-rw-r--r--] | indra/lib/python/uuid.py | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/indra/lib/python/uuid.py b/indra/lib/python/uuid.py index 48dac84377..e956383cca 100644..100755 --- a/indra/lib/python/uuid.py +++ b/indra/lib/python/uuid.py @@ -1,3 +1,24 @@ +#!/usr/bin/python +## $LicenseInfo:firstyear=2011&license=viewerlgpl$ +## Second Life Viewer Source Code +## Copyright (C) 2011, Linden Research, Inc. +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; +## version 2.1 of the License only. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +## $/LicenseInfo$ r"""UUID objects (universally unique identifiers) according to RFC 4122. This module provides immutable UUID objects (class UUID) and the functions @@ -446,8 +467,14 @@ def uuid1(node=None, clock_seq=None): def uuid3(namespace, name): """Generate a UUID from the MD5 hash of a namespace UUID and a name.""" - import md5 - hash = md5.md5(namespace.bytes + name).digest() + try: + # Python 2.6 + from hashlib import md5 + except ImportError: + # Python 2.5 and earlier + from md5 import new as md5 + + hash = md5(namespace.bytes + name).digest() return UUID(bytes=hash[:16], version=3) def uuid4(): |