mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/securerandom.rb (random_bytes): Use Process.clock_gettime.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9eb141196b
commit
7a4feec795
2 changed files with 6 additions and 2 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
Sat Aug 31 14:07:11 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* lib/securerandom.rb (random_bytes): Use Process.clock_gettime.
|
||||||
|
|
||||||
Sat Aug 31 00:25:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Aug 31 00:25:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* include/ruby/encoding.h (rb_{ascii8bit,utf8,usascii}_encindex): get
|
* include/ruby/encoding.h (rb_{ascii8bit,utf8,usascii}_encindex): get
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ module SecureRandom
|
||||||
@pid = 0 unless defined?(@pid)
|
@pid = 0 unless defined?(@pid)
|
||||||
pid = $$
|
pid = $$
|
||||||
unless @pid == pid
|
unless @pid == pid
|
||||||
now = Time.now
|
now = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond)
|
||||||
ary = [now.to_i, now.nsec, @pid, pid]
|
ary = [now, @pid, pid]
|
||||||
OpenSSL::Random.random_add(ary.join("").to_s, 0.0)
|
OpenSSL::Random.random_add(ary.join("").to_s, 0.0)
|
||||||
@pid = pid
|
@pid = pid
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue