作者StaticVortex ()
看板ask-why
标题Re: [请益] 乱数表有没有规律??
时间Wed May 20 23:52:34 2009
感谢回应,
提供几点回响,
也许有误或不足,
希望不吝指教.
关於以使用者击键时间间隔为乱数种子,
可能会由於作业系统对键盘缓存的设计,
使得当程式要求读值时,
在缓存中的几笔资料在很短的时间内送往程式,
也就失去了原来自然乱数的性质.
https://www.random.org/randomness/
For example, it can be tricky to use keystrokes in this fashion,
because keystrokes are often buffered by the computer's operating system,
meaning that several keystrokes are collected
before they are sent to the program waiting for them.
To a program waiting for the keystrokes,
it will seem as though the keys were pressed almost simultaneously,
and there may not be a lot of randomness there after all.
http://msdn.microsoft.com/en-us/library/aa459265.aspx
Keystrokes occur asynchronously with user action
while the I/O Manager sends the driver an IRP for the read request.
The driver gives the appearance of simultaneously receiving input
from the device and passing the keystroke data to I/O Manager
by maintaining a buffer of keystrokes.
在应用自然乱数於资讯安全时,
如果重复使用虚拟乱数产生器作为新种子,
通常会使产生的乱数品质变差,
http://www.lavarnd.org/faq/prng.html
To achieve output unpredictability of high quality PRNG,
one must start with an unpredictable seed.
Using second PRNG to create the seed does not help
because that simply transfers the problem of seeding onto the second PRNG.
Worse yet, using a PRNG to repeatedly seed another (or even worse the same)
PRNG usually degrades the quality of the output.
但在这篇专利
http://www.google.com/patents?id=ou0gAAAAEBAJ
(
www.lavarnd.org 前身 lavarand 使用的技术
参见
http://www.wired.com/wired/archive/11.08/random.html
Lavarand, a patented system that used Lava Lites to help generate random
numbers. (Patent 5,732,138: "Method for seeding a pseudo-random number
generator with a cryptographic hash of a digitization of a chaotic system.")
)
它将经由浑沌系统产生的自然乱数先杂凑过後再作为种子,
" the present invention pertains to an apparatus and method
for producing a seed for a pseudo-random number generator
from hashing the digitization of a chaotic source.
其理由这麽说
" The cryptographic hashing function serves several purposes.
The cryptographic hash make it difficult to predict the chaotic system.
Furthermore, small variations in the digitized chaotic system
will produce extremely different binary strings.
In addition, knowledge about the cryptographic hash
yields no information regarding the chaotic system.
其举了 state of clouds 作为例子说明
locality inherent 使浑沌系统在某些程度上可以被预测,
而使用 hash function 转换 後 可以消抹 locality inherent 性质.
( given hash(x) , it is hard to find hash(x+1) )
不过经过一次杂凑, 为什麽不会像前面引文所指,反而使乱数品质变差呢?
如果跳过杂凑, 直接将自然乱数作为乱数种子丢到虚拟乱数产生器所产生的金钥,
没办法有效消抹 locality inherent 性质 吗?
※ 引述《H45 (!H45)》之铭言:
: 此问题应回归於:为何需要乱数?
: 因实际需求,有些乱数要求无法预测以提升系统安全
: 有些乱数要求分布足够均匀以提升搜寻效果
: 而有些乱数要求模拟真实环境以测试系统容错能力
: 基於以上需求,有些情况并非虚拟乱数可以满足
: 无法预测的特性乃自然乱数优於虚拟乱数的原因之一
: 在一般的情况下
: 虚拟乱数 (如 Java 内建 Random 类别所含演算法) 已经足以应付大部分的需求
: 好比说:随机从题库抓练习题、随机阅读网路的一篇文章
: 并不需要多麽难以预测的乱数源,只要虚拟乱数即可。
: 然而,需要绝对无法被猜到的情况下,自然乱数比虚拟乱数更加可靠
: 好比说:随机产生加密金钥、随机产生杂讯
: 自然乱数保证任何人都无法准确地猜到未来的乱数是多少
: 毕竟人类还没有能力预言这个世界的所有细节。
: 回到原发问者的问题:以使用者的 input 时间间隔来取种子的方式会遇到什麽限制?
: 假设使用者 input 时间间隔足够称为自然乱数 (不是由机器精准地以固定时间输入)
: 那麽,此种子即为自然乱数,後面的种种运算都是基於自然乱数的结果
: 此时间间隔不能说是伪乱数。
: 然而,如果将自然乱数再做一次虚拟乱数演算法所得到的数值,并不能称之为自然乱数
: 因为每一次运算所得到数值都与自然乱数相关
: 连续做多次虚拟乱数演算法所得到一连串数字彼此之间有关联
: 这些数字只能代表同一个自然乱数的衍生物
: 只要知道第一个数字是多少,後面的数字全部都可以推算出来
: 相对地,一连串真正的自然乱数是知道第一个数字,仍然无法推算出其他乱数是多少。
: 举例而言,你有办法知道另一个使用者 (人) input 的时间间隔吗?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.42.20.13
1F:→ StaticVortex:对了, 如果自然乱数不比某些虚拟乱数均匀, 05/21 00:07
2F:→ StaticVortex:那麽在运用 random sampling 时, 应该用哪种呢? 05/21 00:07
3F:推 HuangJC:我倒认为对取样来说,只要均匀就有价值了;而 random 是防止 05/21 03:03
4F:→ HuangJC:投机;比如取样100次,得到的数据放大到10000次,如果我的取 05/21 03:04
5F:→ HuangJC:样方式被摸透,就有人会投机塞样本给我;只担心这件事而已 05/21 03:04
6F:推 HuangJC:另外,只要知道第一个数就可以推出一连串乱数,这很好破呀 05/21 03:07
7F:→ HuangJC:改用第一及第二个数同时运算产生第三个数就好;不必引入自 05/21 03:07
8F:→ HuangJC:然乱数啦 :P 05/21 03:08
9F:→ HuangJC:我是说,不必永远依赖自然乱数 05/21 03:08