lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


lua-arc4random is a wrapper around OpenBSD's arc4random. It provides two
methods, including a safe drop-in replacement for math.random.

arc4random implements ChaCha20, which is a strong and efficient RNG,
suitable for generating cryptographic secrets. It is also more robust
than other methods like urandom, which fails when you run out of file
descriptors, and has issues with chroots. You can find more information
in the man file:

http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/arc4random.3

Under the hood, I am using code from libressl-portable to provide the
arc4random calls on operating systems that do not support it.


Mike