Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
098bcc5a
Commit
098bcc5a
authored
Mar 10, 2015
by
vitzli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add crypto-notes.md; closes #911
parent
e0601611
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
dev/crypto-notes.md
dev/crypto-notes.md
+40
-0
No files found.
dev/crypto-notes.md
0 → 100644
View file @
098bcc5a
## Important notes
### Key-pair generation
When compared to gpg without hardware-based (P)RNG, IPFS generates key-pair
alarmingly fast: it takes ipfs about 1 minute to generate 4096-bit
key-pair, but for gpg it takes about 10 minutes. In the same time
entropy_avail show severe drop in available entropy for gpg, but for
ipfs entropy drops about 100 bits.
[
This issue (#911)
](
https://github.com/jbenet/go-ipfs/issues/911
)
seems to be caused
by
`crypto/rand`
implementation in the Go programming language:
1.
[
in UNIX-like
](
http://golang.org/src/crypto/rand/rand_unix.go
)
operating
system it uses /dev/urandom device:
```
// Easy implementation: read from /dev/urandom.
// This is sufficient on Linux, OS X, and FreeBSD.
```
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.
2.
[
in Linux
](
http://golang.org/src/crypto/rand/rand_linux.go#L22
)
it falls back
to urandom in several cases:
```
// Test whether we should use the system call or /dev/urandom.
// We'll fall back to urandom if:
// - the kernel is too old (before 3.17)
// - the machine has no entropy available (early boot + no hardware
// entropy source?) and we want to avoid blocking later.
```
The first clause would be used for several production-class operationg systems.
3.
[
in Windows
](
)
it uses Windows CryptGenRandom API.
According to
[
wikipedia
](
https://en.wikipedia.org/?title=/dev/random
)
using
/dev/urandom instead of /dev/random seems to be safe.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment