Module OpenID::CryptUtil
In: lib/openid/cryptutil.rb

This module contains everything needed to perform low-level cryptograph and data manipulation tasks.


Public Class methods

Decode a base64 byte string to a number.

Convert a string of bytes into a number.

Encode a number as a base64-encoded byte string.

Convert a number to its binary representation; return a string of bytes.

Generate a random number, doing a little extra work to make it more likely that it‘s suitable for cryptography. If your system doesn‘t have /dev/urandom then this number is not cryptographically safe. See <> for more information. max is the largest possible value of such a random number, where the result will be less than max.

Generate a random string of the given length, composed of the specified characters. If chars is nil, generate a string composed of characters in the range 0..255.