Does the SHA1PRNG algorithm for SecureRandom use /dev/random for entropy?

后端 未结 1 633
逝去的感伤
逝去的感伤 2021-01-24 16:22

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

How to solve performance problem with Java SecureR

相关标签:
1条回答
  • 2021-01-24 16:33

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

    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);
    
    0 讨论(0)
提交回复
热议问题