diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2013-10-19 14:38:58 +0400 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2013-11-19 13:15:50 +0400 |
commit | 88dc1fcb62f40c3c906802dcaa8a8e9dfef2a264 (patch) | |
tree | 052b8a42660ad2324e02e9b69cd9e98bf1d49b66 | |
parent | fce0eb416b47f205605fe3dde47550dec337c673 (diff) | |
download | node-new-88dc1fcb62f40c3c906802dcaa8a8e9dfef2a264.tar.gz |
crypto: `randomBytes` is non-blocking
Add NOTE section in documentation, mentioning that `randomBytes` won't
block when entropy sources are drained.
fix #6372
-rw-r--r-- | doc/api/crypto.markdown | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/api/crypto.markdown b/doc/api/crypto.markdown index e0fe26f5bd..1aba68ee36 100644 --- a/doc/api/crypto.markdown +++ b/doc/api/crypto.markdown @@ -465,8 +465,14 @@ Generates cryptographically strong pseudo-random data. Usage: console.log('Have %d bytes of random data: %s', buf.length, buf); } catch (ex) { // handle error + // most likely, entropy sources are drained } +NOTE: Will throw error or invoke callback with error, if there is not enough +accumulated entropy to generate cryptographically strong data. In other words, +`crypto.randomBytes` without callback will not block even if all entropy sources +are drained. + ## crypto.pseudoRandomBytes(size, [callback]) Generates *non*-cryptographically strong pseudo-random data. The data |