libsodium-bindings-0.0.1.1: FFI bindings to libsodium
Copyright(C) Koz Ross 2022
LicenseBSD-3-Clause
Maintainerkoz.ross@retro-freedom.nz
StabilityStable
PortabilityGHC only
Safe HaskellSafe-Inferred
LanguageHaskell2010

LibSodium.Bindings.Random

Description

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

Documentation

randombytesRandom :: IO Word32 Source #

Produces an unpredictable four-byte value.

See: randombytes_random()

Since: 0.0.1.0

randombytesUniform Source #

Arguments

:: Word32

upper limit (exclusive)

-> IO Word32 

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.

See: randombytes_uniform()

Since: 0.0.1.0

randombytesBuf Source #

Arguments

:: Ptr Word8

Out-parameter to fill

-> CSize

How many bytes to generate

-> IO ()

No meaningful return value

Fills a buffer of the given size with unpredictable bytes.

See: randombytes_buf()

Since: 0.0.1.0