-
Notifications
You must be signed in to change notification settings - Fork 85
Utilities
tarcieri edited this page Feb 15, 2013
·
2 revisions
There are some helpful functions for performing common tasks in cryptography. These include random data generation (for example, for key material) using the operating system random source and constant-time comparisons of strings, to avoid exposing information through timing attacks.
# random strings
Crypto::Random.random_bytes(32)
#=> 32 bytes of randomness, from the OS
# constant time comparisons.
Crypto::Util.verify32(string_one, string_two)
#=> true/false. See also verify16