How to deal with a slow SecureRandom generator?

后端 未结 17 1113
时光说笑
时光说笑 2020-11-22 11:56

If you want a cryptographically strong random numbers in Java, you use SecureRandom. Unfortunately, SecureRandom can be very slow. If it uses

17条回答
  •  长情又很酷
    2020-11-22 12:33

    If your hardware supports it try using Java RdRand Utility of which I'm the author.

    Its based on Intel's RDRAND instruction and is about 10 times faster than SecureRandom and no bandwidth issues for large volume implementation.


    Note that this implementation only works on those CPU's that provide the instruction (i.e. when the rdrand processor flag is set). You need to explicitly instantiate it through the RdRandRandom() constructor; no specific Provider has been implemented.

提交回复
热议问题