You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ggentropy is a liberally licensed and cross platform entropy library.
You can use it to generate cryptographically secure random numbers, safe
for use as nonces and keys in cryptographic operations.
ggentropy supports Windows, Apple platforms, Linux, FreeBSD, OpenBSD and
NetBSD.
Version history
v1.0 19th Jul 2021:
Use arc4random_buf on Apple platforms
Drop /dev/urandom fallback on Linux because all versions that
require it have been EOL for years
Drop Solaris support
Usage
ggentropy has one function:
boolggentropy( void * buf, size_t n );
which writes n bytes of crytographically secure random data to buf.
It returns true on success and false on failure. Some platforms place a
length restriction on n, so the library will exit on all platforms if
n is greater than 256.
ggentropy can fail. In long lived programs you should use it to seed a
userspace cryptographically secure psuedo-random number generator once
at program startup and use that for all future cryptographically secure
random data. For example, you can encrypt a stream of zeroes using a key
chosen by ggentropy, and use the output of the cipher as a random number
source.