Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge revision(s) 32741:

?\012
	* lib/securerandom.rb: call OpenSSL::Random.seed at the
	  SecureRandom.random_bytes call.
	  based on the patch by Masahiro Tomita.  [ruby-dev:44270]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@32741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org>

git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@34003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit b696930909cdac368d09cec8ae4bc328a8689a7b 1 parent 3dbcd24
@shyouhei shyouhei authored
Showing with 9 additions and 2 deletions.
  1. +7 −0 ChangeLog
  2. +2 −2 lib/securerandom.rb
View
7 ChangeLog
@@ -1,3 +1,10 @@
+Sat Dec 10 20:44:23 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/securerandom.rb: call OpenSSL::Random.seed at the
+ SecureRandom.random_bytes call.
+ insert separators for array join.
+ patch by Masahiro Tomita. [ruby-dev:44270]
+
Mon Oct 17 04:20:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* mkconfig.rb: fix for continued lines. based on a patch from
View
4 lib/securerandom.rb
@@ -50,12 +50,12 @@ module SecureRandom
def self.random_bytes(n=nil)
n ||= 16
if defined? OpenSSL::Random
- @pid = $$ if !defined?(@pid)
+ @pid = 0 if !defined?(@pid)
pid = $$
if @pid != pid
now = Time.now
ary = [now.to_i, now.usec, @pid, pid]
- OpenSSL::Random.seed(ary.to_s)
+ OpenSSL::Random.seed(ary.join('.'))
@pid = pid
end
return OpenSSL::Random.random_bytes(n)
Please sign in to comment.
Something went wrong with that request. Please try again.