vendredi 24 février 2017

How to get entropy from JVM?

Let's say I need good seed to initialize pseudo random generator (PRNG) in Java program and I don't have access to any hardware random generator.

How to get entropy from JVM? Please post your ideas / code examples in JAVA.

I need many sources of entropy which will be combined to one byte array. Then I will generate digest of entropy which will be seed to PRNG.

My ideas

  • Current nano time
  • Create new references and get addresses
  • Environment variables / properties hashes
  • Get random bytes from memory

PRNG warning

Please note SHA1PRNG is default pseudo random generator in JAVA up to 8 version. SHA-1 has been broken by Google few day ago




Aucun commentaire:

Enregistrer un commentaire