SecureRandom的SHA1PRNG算法对于熵使用/ dev / random吗? [英] Does the SHA1PRNG algorithm for SecureRandom use /dev/random for entropy?

查看:1570
本文介绍了SecureRandom的SHA1PRNG算法对于熵使用/ dev / random吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在javadocs和在线找到这个,但找不到一个确定的答案。 Dan Dyer在

I tried looking for this in the javadocs and online but couldn't find a definitive answer. The answer by Dan Dyer in

如何解决Java SecureRandom的性能问题?

似乎建议SHA1PRNG不使用任何系统资源的熵。这是正确的吗?

Seems to suggest SHA1PRNG does not use any system resources for entropy. Is this correct?

推荐答案

不,在默认的Oracle实现中,它使用系统资源,除非你在调用 nextBytes()。从 SecureRandom 的Sun / Oracle文档:

No, in the default Oracle implementation it uses system resources, unless you seed it before calling nextBytes(). From the Sun/Oracle documentation of SecureRandom:


SecureRandom实现尝试完全随机化生成器本身的内部状态,除非调用者通过调用setSeed方法调用getInstance方法:

The SecureRandom implementation attempts to completely randomize the internal state of the generator itself unless the caller follows the call to a getInstance method with a call to the setSeed method:

 SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
 random.setSeed(seed);


这篇关于SecureRandom的SHA1PRNG算法对于熵使用/ dev / random吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆