diff options
Diffstat (limited to 'lib/securerandom.rb')
-rw-r--r-- | lib/securerandom.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/securerandom.rb b/lib/securerandom.rb index 9faa09e4e0..81757f3100 100644 --- a/lib/securerandom.rb +++ b/lib/securerandom.rb @@ -40,19 +40,27 @@ require 'random/formatter' module SecureRandom - VERSION = "0.2.2" + # The version + VERSION = "0.3.1" class << self + # Returns a random binary string containing +size+ bytes. + # + # See Random.bytes def bytes(n) return gen_random(n) end private + # :stopdoc: + + # Implementation using OpenSSL def gen_random_openssl(n) return OpenSSL::Random.random_bytes(n) end + # Implementation using system random device def gen_random_urandom(n) ret = Random.urandom(n) unless ret @@ -78,6 +86,9 @@ module SecureRandom end end + # :startdoc: + + # Generate random data bytes for Random::Formatter public :gen_random end end |