Christian Heimes <[email protected]> added the comment:
We use os.urandom() because it is backed by a cryptographicly secure random
number generator. The random module uses a non-secure RNG. While RFC 4122 does
not mandate a CSRPNG, application often rely on unpredictable UUIDs.
Correctness and security is more important here than performance.
If you need a faster uuid4 implementation, then you can role your own with a
couple of lines of code:
import random
from uuid import UUID
def uuid4_fast():
return UUID(int=random.getrandbits(128), version=4)
----------
nosy: +christian.heimes
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45556>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com