* random.c (rand_random_number): add a method to return a random
number like SecureRandom to Random::Formatter.
* lib/securerandom.rb (random_bytes): move to Random::Formatter,
the base method of the module.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/securerandom.rb (Random::Formatter): extract random number
formatting methods into a module.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c (random_raw_seed): extract platform dependent random
seed initialization function as a new method Random.raw_seed.
* lib/securerandom.rb (SecureRandom): use Random.raw_seed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/securerandom.rb (SecureRandom.gen_random): separate
implementation details and select at the load time.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/securerandom.rb: set the script encoding to make a string
literal in SecureRandom::Kernel32.last_error_message single byte
encoding so msg[] works in bytes, since FormatMessage() returns
the size in TCHARs, not in characters.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
before cheking `/dev/urandom` because we know windows doesn't have it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Based on a patch by @schneems [Fixes GH-518] [ci skip]
https://github.com/ruby/ruby/pull/518
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
OpenSSL::Random.random_add instead of OpenSSL::Random.seed and
specify 0.0 as the entropy.
[ruby-core:47308] [Bug #6928]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/securerandom.rb (SecureRandom.random_bytes):
Use 64bit value as pointer for Windows x64 to fix SystemCallError.
* lib/securerandom.rb (SecureRandom.lastWin32ErrorMessage):
Set proper encoding to avoid invalid byte sequence error.
[ruby-core:47451] [Bug #6990]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
SecureRandom.random_bytes call.
based on the patch by Masahiro Tomita. [ruby-dev:44270]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to prevent random number sequence repeatation at forked child
process which has same pid.
reported by Eric Wong. [ruby-core:35765]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
/dev/urandom is a symlink in OpenSolaris.
* lib/securerandom.rb (SecureRandom.random_bytes: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
instead of string, because String#[] returns one length string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e