SystemRNG

Operating system specific cryptography secure random number generator.

It uses the "CryptGenRandom" function for Windows; the "arc4random_buf" function (not based on RC4 but on a modern and cryptographically secure cipher) for macOS/OpenBSD/NetBSD; the "getrandom" syscall for Linux 3.17 and later; and "/dev/urandom" for other Posix platforms. It's recommended to combine the output use additional processing generated random numbers via provided functions for systems where security matters.

Remarks: Windows "CryptGenRandom" RNG has known security vulnerabilities on Windows 2000 and Windows XP (assuming the attacker has control of the machine). Fixed for Windows XP Service Pack 3 and Windows Vista.

Constructors

this
this()

Creates new system random generator

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

read
alias read = RandomNumberStream.read
Undocumented in source.

Functions

peek
const(ubyte)[] peek()
Undocumented in source. Be warned that the author may not have intended to support it.
read
size_t read(ubyte[] buffer, IOMode mode)
Undocumented in source.

Properties

dataAvailableForRead
bool dataAvailableForRead [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
empty
bool empty [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
leastSize
ulong leastSize [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From RandomNumberStream

read
size_t read(ubyte[] dst, IOMode mode)

Fills the buffer new random numbers.

read
alias read = InputStream.read
Undocumented in source.

See Also

Meta