diff options
author | konsumlamm <44230978+konsumlamm@users.noreply.github.com> | 2021-04-08 19:41:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 12:41:43 -0500 |
commit | 9f0f4775524d6167655e089a864cd9fdbd10c806 (patch) | |
tree | 87f67d5884e034cd2604eb71e3ea0f6fcce6f045 /lib/std/sysrand.nim | |
parent | 42687457b079c16f69b22ff2354590780bd4cf45 (diff) | |
download | Nim-9f0f4775524d6167655e089a864cd9fdbd10c806.tar.gz |
Update `sysrand` documentation (#17676)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'lib/std/sysrand.nim')
-rw-r--r-- | lib/std/sysrand.nim | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/std/sysrand.nim b/lib/std/sysrand.nim index c9908143c..4a2cdd10b 100644 --- a/lib/std/sysrand.nim +++ b/lib/std/sysrand.nim @@ -12,21 +12,21 @@ ## therefore may not be secure. ## ## `std/sysrand` generates random numbers from a secure source provided by the operating system. -## It is also called Cryptographically secure pseudorandom number generator. -## It should be unpredictable enough for cryptographic applications, +## It is a cryptographically secure pseudorandom number generator +## and should be unpredictable enough for cryptographic applications, ## though its exact quality depends on the OS implementation. ## -## | Targets | Implementation| -## | :--- | ----: | -## | Windows | `BCryptGenRandom`_ | -## | Linux | `getrandom`_ | -## | MacOSX | `getentropy`_ | -## | IOS | `SecRandomCopyBytes`_ | -## | OpenBSD | `getentropy openbsd`_ | -## | FreeBSD | `getrandom freebsd`_ | -## | JS(Web Browser) | `getRandomValues`_ | -## | Nodejs | `randomFillSync`_ | -## | Other Unix platforms | `/dev/urandom`_ | +## | Targets | Implementation | +## | :--- | ----: | +## | Windows | `BCryptGenRandom`_ | +## | Linux | `getrandom`_ | +## | MacOSX | `getentropy`_ | +## | iOS | `SecRandomCopyBytes`_ | +## | OpenBSD | `getentropy openbsd`_ | +## | FreeBSD | `getrandom freebsd`_ | +## | JS (Web Browser) | `getRandomValues`_ | +## | Node.js | `randomFillSync`_ | +## | Other Unix platforms | `/dev/urandom`_ | ## ## .. _BCryptGenRandom: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom ## .. _getrandom: https://man7.org/linux/man-pages/man2/getrandom.2.html @@ -195,7 +195,7 @@ elif defined(linux): elif defined(openbsd): proc getentropy(p: pointer, size: cint): cint {.importc: "getentropy", header: "<unistd.h>".} - # fills a buffer with high-quality entropy, + # Fills a buffer with high-quality entropy, # which can be used as input for process-context pseudorandom generators like `arc4random`. # The maximum buffer size permitted is 256 bytes. @@ -227,7 +227,7 @@ elif defined(ios): proc secRandomCopyBytes( rnd: SecRandomRef, count: csize_t, bytes: pointer - ): cint {.importc: "SecRandomCopyBytes", header: "<Security/SecRandom.h>".} + ): cint {.importc: "SecRandomCopyBytes", header: "<Security/SecRandom.h>".} ## https://developer.apple.com/documentation/security/1399291-secrandomcopybytes template urandomImpl(result: var int, dest: var openArray[byte]) = @@ -292,7 +292,7 @@ proc urandom*(dest: var openArray[byte]): bool = ## If the call succeeds, returns `true`. ## ## If `dest` is empty, `urandom` immediately returns success, - ## without calling underlying operating system api. + ## without calling the underlying operating system API. ## ## .. warning:: The code hasn't been audited by cryptography experts and ## is provided as-is without guarantees. Use at your own risks. For production |