Module artichoke_backend::extn::stdlib::securerandom[][src]

Secure random number generator interface.

This module implements the SecureRandom package from the Ruby Standard Library. It is an interface to secure random number generators which are suitable for generating session keys in HTTP cookies, etc.

You can use this library in your application by requiring it:

require 'securerandom'

This implementation of SecureRandom supports the system RNG via the getrandom crate. This implementation does not depend on OpenSSL.

Modules

hex

Functions for encoding sequences of bytes into base 16 hex encoding.

mruby

FFI glue between the Rust trampolines and the mruby C interpreter.

trampoline

Glue between mruby FFI and securerandom Rust implementation.

Structs

ArgumentError

Error that indicates an argument parsing or value logic error occurred.

DomainError

Error that indicates the given maximum value is not finite and cannot be used to bound a domain for generating random numbers.

RandomBytesError

Error that indicates the underlying source of randomness failed to generate the requested random bytes.

SecureRandom

A handle to the underlying secure random number generator.

Enums

Max

Max value when generating a random number from a range.

Rand

Random numeric value generated from the secure random number generator.

SecureRandomError

Sum type of all errors possibly returned from random_bytes.

Functions

alphanumeric

Generate a random sequence of ASCII alphanumeric bytes.

base64

Generate a base64-encoded String of random bytes.

hex

Generate a hex-encoded String of random bytes.

random_bytes

Generate a vector of random bytes.

random_number

Generate a single random number, either a float or an integer.

urlsafe_base64

Generate a URL-safe base64-encoded String of random bytes.

uuid

Generate a version 4 UUID and return a String.