Copyright | (C) Koz Ross 2022 |
---|---|
License | BSD-3-Clause |
Maintainer | koz.ross@retro-freedom.nz |
Stability | Stable |
Portability | GHC only |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A collection of functions for securely generating unpredictable data. This uses the best option on each platform, as follows:
- On Windows,
RtlGenRandom
. - On FreeBSD and Linux,
getrandom
syscall. - On other UNIX platforms,
/dev/urandom
.
Synopsis
- randombytesRandom :: IO Word32
- randombytesUniform :: Word32 -> IO Word32
- randombytesBuf :: Ptr Word8 -> CSize -> IO ()
Documentation
Produces an unpredictable four-byte value not larger than the argument. This function guarantees a uniform distribution on results, even if the upper limit is not a power of 2.
Since: 0.0.1.0