edit formatting
vitzli committed
Mar 10, 2015 at 21:59 UTC
67600a73ea9b2645314677eed750f8830c8d2e54
1 file changed
+19
-24
dev/crypto-notes.md
+19
-24
@@ -11,30 +11,25 @@ ipfs entropy drops about 100 bits.
11
[This issue (#911)](https://github.com/jbenet/go-ipfs/issues/911) seems to be caused
12
by `crypto/rand` implementation in the Go programming language:
13
14
-1. [in UNIX-like](http://golang.org/src/crypto/rand/rand_unix.go) operating
15
-system it uses /dev/urandom device:
16
-```
17
-// Easy implementation: read from /dev/urandom.
18
-// This is sufficient on Linux, OS X, and FreeBSD.
19
-```
20
-
21
-For OS X that would use 160-bit Yarrow PRNG based on SHA-1 key,
22
-for FreeBSD - 256-bit Yarrow algorithm. For both operating systems /dev/random and
23
-/dev/urandom are equal.
24
-
25
-2. [in Linux](http://golang.org/src/crypto/rand/rand_linux.go#L22) it falls back
26
-to urandom in several cases:
27
-```
28
-// Test whether we should use the system call or /dev/urandom.
29
-// We'll fall back to urandom if:
30
-// - the kernel is too old (before 3.17)
31
-// - the machine has no entropy available (early boot + no hardware
32
-// entropy source?) and we want to avoid blocking later.
33
-```
34
-
35
-The first clause would be used for several production-class operationg systems.
14
+1. [in UNIX-like](http://golang.org/src/crypto/rand/rand_unix.go) operating system it uses /dev/urandom device:
15
+ ```
16
+ // Easy implementation: read from /dev/urandom.
17
+ // This is sufficient on Linux, OS X, and FreeBSD.
18
+ ```
19
+
20
+ For OS X that would use 160-bit Yarrow PRNG based on SHA-1 key, for FreeBSD - 256-bit Yarrow algorithm. For both operating systems /dev/random and /dev/urandom are equal.
21
+
22
+2. [in Linux](http://golang.org/src/crypto/rand/rand_linux.go#L22) it falls back to urandom in several cases:
23
+ ```
24
+ // Test whether we should use the system call or /dev/urandom.
25
+ // We'll fall back to urandom if:
26
+ // - the kernel is too old (before 3.17)
27
+ // - the machine has no entropy available (early boot + no hardware
28
+ // entropy source?) and we want to avoid blocking later.
29
+ ```
30
+
31
+ The first clause would be used for several production-class operationg systems.
32
33
3. [in Windows]() it uses Windows CryptGenRandom API.
34
39
-According to [wikipedia](https://en.wikipedia.org/?title=/dev/random) using
40
-/dev/urandom instead of /dev/random seems to be safe.
35
+According to [wikipedia](https://en.wikipedia.org/?title=/dev/random) using /dev/urandom instead of /dev/random seems to be safe.