开发者

random number generator dev/random

I read that the random number generator dev/random on Mac and Solaris inclu开发者_如何学Godes 160 bits of entropy. What can I do, if I need more entropy, for example, 200 bits? Thanks in advance


I'm not sure where you read that 160-bit estimate -- I believe that Solaris, Mac and most BSDs use a 256-bit Yarrow implementation. At any rate, the entropy pool is regularly refilled from even the smallest amount of network or disk activity, so, even though /dev/random on non-Linux systems doesn't actually block "waiting for more entropy" (it's more like a supposedly higher-quality version of /dev/urandom, to which on these systems it's typically linked), nothing stops you (if you trust, say, no more than 160 bits at a time from the /dev) from "blocking and refreshing entropy" yourself -- get N bits, do some disk or network I/O, get another N bits, and so forth.


And if you think your disk access is too predictable, you could go for some really bizzare sources like, say, a few of the most recent twitter entries if your program has internet access;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜