消息 [217494]
> The problem is AFAICT there's currently no way to get a file
> descriptor to the underlying /dev/urandom (and I don't know how it
> works on Windows).
We can reimplement os.urandom in SystemRandom on UNIX to keep the file (fd)
open. The code is very simple, basically it's just a call to file.read(n).
Adding a randbytes() method in Python 3.5 would be nice.
The io module can handle boring things for you, like calling read in a loop
until you get enough bytes and handle InterruptError.
Except if you would prefer to use os.read or FileIO.read to avoid readahead. |
|
| 日期 |
用户 |
动作 |
参数 |
| 2014-04-29 08:37:46 | vstinner | 修改 | recipients:
+ vstinner, ncoghlan, janssen, giampaolo.rodola, christian.heimes, benjamin.peterson, alex, neologix, tshepang, dstufft, josh.r |
| 2014-04-29 08:37:46 | vstinner | 链接 | issue21305 messages |
| 2014-04-29 08:37:45 | vstinner | 创建 | |
|