Message241866
> If you have to care about security, you shouldn't use the random module
> at all. random.SystemRandom() merely uses a CPRNG as entropy source. But
> It also manipulates numbers in ways that may or may not be safe.
I must respectfully disagree with this. The current docs say:
> Use os.urandom() or SystemRandom if you require a cryptographically
> secure pseudo-random number generator.
That's a pretty strong statement, and IMO it would lead most to believe that SystemRandom along with *all* of its member functions is safe to use for cryptographic purposes[1] (assuming of course that os.urandom() is also a safe CSPRNG).
As a compromise, perhaps SystemRandom could provide its own randrange() with the #9025 fix, while keeping random.randrange() unmodified to preserve the implied same-sequence rule.
[1] I don't mean to imply that this bias bug necessarily is a cryptographic safety issue--it seems unlikely to me that it is one, however not being a cryptographer myself, I'd rather not draw any conclusions either way, and instead I'd prefer to err on the side of safety. |
|
Date |
User |
Action |
Args |
2015-04-23 16:14:47 | gurnec | set | recipients:
+ gurnec, skip.montanaro, rhettinger, mark.dickinson, christian.heimes, serhiy.storchaka |
2015-04-23 16:14:47 | gurnec | set | messageid: <1429805687.51.0.292860810145.issue23974@psf.upfronthosting.co.za> |
2015-04-23 16:14:47 | gurnec | link | issue23974 messages |
2015-04-23 16:14:47 | gurnec | create | |
|