Seeding SecureRandom from user touch events in Android
我正在创建Android应用程序,它将安全地随机生成256位密钥。我还希望用户可以选择通过点击/拖动屏幕来生成随机字节,该屏幕将为随机数生成器种子(类似于TrueCrypt生成其键的方式)。看起来我最好是用
文件如下:
Reseeds this random object. The given seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.
号
我计划获取用户触摸事件的x和y坐标并对它们进行散列,然后将散列中的字节反复输入
我的问题是,随后对
是的,"或多或少没用"。
从文档中:
"any seed material passed to a SecureRandom object must be unpredictable", mouse movement probably does not meet that standard.
号
一般来说,CPRNS会不断地从设备上的事件添加种子,这样做不会更好。
同样来自文档:
void setSeed (long seed)
Reseeds this random object, using the eight bytes contained in the given long seed. The given seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.
号
所以继续说吧,你不会有任何伤害,但是你是否会改进什么是值得怀疑的。