2012-11-27 85 views
4

我在讀關於隨機數及其代數。自從我開始編程以來,我對隨機性感興趣。我讀過Linux內核也使用隨機數生成架構。/dev /隨機許可被拒絕

The structure consists of a two-level cascaded sequence of pools coupled with 
CSPRNGs. 
Each pool is a large group of bits which represents the current state of the 
random number generator. The CSPRNGs are currently based on SHA-1, but the 
kernel developers are considering a switch to SHA-3. 

The kernel RNG produces two user-space output streams. One of these goes to 
/dev/urandom and also to the kernel itself; the latter is useful because there 
are uses for random numbers within the kernel. The other output stream goes to 
/dev/random. The difference between the two is that /dev/random tries to estimate 
how much entropy is coming into the system, and will throttle its output if there 
is insufficient entropy. By contrast, the /dev/urandom stream does not throttle 
output, and if users consume all of the available entropy, the interface degrades 
to a pure CSPRNG. 

因此,充滿激動,我嘗試進入並檢查/ dev/random和/ dev/urandom中有什麼。但它說,

[email protected]:/home/sunny# /dev/random 
bash: /dev/random: Permission denied 

[email protected]:/home/sunny# /dev/urandom 
bash: /dev/urandom: Permission denied 

但是,當我檢查「ls」命令時,我可以看到/ dev中的「隨機」。 我想詳細瞭解這一點。

回答

8

/dev/random不是可執行文件。嘗試cat /dev/random。或者如果你不喜歡測試你的反應,dd if=/dev/random bs=128 count=1將顯示有限的隨機垃圾。

+4

儘管準備好Ctrl-c很快...... – Xymostech

+0

@Xymostech是的,但是如果你能讓你的終端回來,你肯定會看到「那裏有什麼」。 – ldav1s

+2

是的,@Xymostech我準備好了。謝謝。我是否強制它生成隨機數字?還是顯示已經存在的隨機事物? – Sunny