faster better web2py_uuid, thanks Michele

This commit is contained in:
mdipierro committed 2012-10-14 14:16:43 -05:00
1 parent 40c09a5d80
commit 76d619fb34
2 files changed
+2 -3

No files matched your search

+1 -1
View File
@@ -1 +1 @@
Version 2.1.0 (2012-10-13 14:36:14) dev Version 2.1.0 (2012-10-14 14:16:37) dev
+1 -2
View File
@@ -161,8 +161,7 @@ def web2py_uuid(ctokens=UNPACKED_CTOKENS):
It works like uuid.uuid4 except that tries to use os.urandom() if possible It works like uuid.uuid4 except that tries to use os.urandom() if possible
and it XORs the output with the tokens uniquely associated with this machine. and it XORs the output with the tokens uniquely associated with this machine.
""" """
rand_longs = struct.unpack('=QQ', string.join( rand_longs = (random.getrandbits(64),random.getrandbits(64))
(chr(random.randrange(256)) for i in xrange(16)),''))
if HAVE_URANDOM: if HAVE_URANDOM:
urand_longs = struct.unpack('=QQ', fast_urandom16()) urand_longs = struct.unpack('=QQ', fast_urandom16())
byte_s = struct.pack('=QQ', byte_s = struct.pack('=QQ',