检索securerandom数字生成器的种子/检查种子是否与securerandom生成的随机数匹配

vvppvyoh  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(208)

我需要在java中使用securerandom()生成安全的伪随机数。为此,我设置了一个种子,用于生成其他随机数。代码如下所示

SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");

 //generate a given number of seed bytes (to seed other random number generators, for example):
 byte[] bytes = secureRandom.generateSeed(16);

 //print obtained bytes as string from array
 System.out.println(Arrays.toString(bytes));

 //to get random bytes, a caller simply passes an array of any length, which is then filled with random bytes:
 secureRandom.nextBytes(bytes);

 //print obtained bytes as string from array
 System.out.println(Arrays.toString(bytes));

用于生成这些数字的种子将存储在本地存储器中。我的问题是,如果我有随机数,我能从中检索种子吗?或者,由于我在本地存储了种子,我可以用种子交叉检查随机数并检索匹配的种子吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题