Skip to content

Commit 36b6cff

Browse files
committed
Add note about Emscripten OsRng source
1 parent 41dc39b commit 36b6cff

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/rngs/os.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ use rand_core::{CryptoRng, RngCore, Error, impls};
3737
/// otherwise from `/dev/urandom`.
3838
/// - macOS, iOS: calls `SecRandomCopyBytes`.
3939
/// - Windows: calls `RtlGenRandom`.
40-
/// - WASM: calls `window.crypto.getRandomValues` in browsers,
41-
/// and in Node.js `require("crypto").randomBytes`.
40+
/// - WASM (with `stdweb` feature): calls `window.crypto.getRandomValues` in
41+
/// browsers, and in Node.js `require("crypto").randomBytes`.
42+
/// - Emscripten: reads from emulated `/dev/urandom`, which maps to the same
43+
/// interfaces as `stdweb`, but falls back to the insecure `Math.random()` if
44+
/// unavailable.
4245
/// - OpenBSD: calls `getentropy(2)`.
4346
/// - FreeBSD: uses the `kern.arandom` `sysctl(2)` mib.
4447
/// - Fuchsia: calls `cprng_draw`.

0 commit comments

Comments
 (0)