std.internal.entropy
var _entropySource
Types 5
enumEntropySource
A CSPRNG suitable to retrieve cryptographically-secure random data from.
(No actual low-level entropy sources are provided on purpose.)
tryAll = - 1Implements a hunting strategy for finding an entropy source that is available at runtime.
none = 0Always fail.
charDevURandom = 1`/dev/urandom`
charDevRandom = 2`/dev/random`
getrandom = 3`getrandom` syscall or wrapper
arc4random = 4`arc4random`
getentropy = 5
cryptGenRandom = 6Windows legacy CryptoAPI
bcryptGenRandom = 7Windows Cryptography API: Next Generation (“BCrypt”)
enumEntropyStatus
ok = 0success
unknownError = 1catch-all error
unavailableAn entropy source was unavailable.
unavailableLibraryA dependency providing the entropy source turned out unavailable.
unavailablePlatformThe requested entropy source is not supported on this platform.
readErrorCould not retrieve entropy from the selected source.
structEntropyResult
Status report returned by getEntropy functions.
Use the isOK helper function to test for success.
Methods
Fields
srcFunctions 9
fn
EntropyResult getEntropy(scope void[] buffer) @nogc nothrow @safeRetrieves random data from an applicable system CSPRNG.fn
EntropyResult getEntropy(scope void * buffer, size_t length) @nogc nothrow @systemditto Retrieves random data from an applicable system CSPRNG.fn
void forceEntropySource(EntropySource source) @nogc nothrow @safeManually set the entropy source to use for the current thread.fn
EntropyResult getEntropy(scope void * buffer, size_t length, EntropySource source) @nogc nothrow @systemRetrieves random data from the requested entropy source.fn
bool isOK(const EntropyResult value) @nogc nothrow pure @safeDetermines whether an `EntropyResult` reports the success of an operation.fn
bool isUnavailable(const EntropyResult value) @nogc nothrow pure @safeDetermines whether an `EntropyResult` reports the unvailability of the requested entropy source.Variables 1
Templates 1
tmplisValidSupportedSource(SupportedSource)