提交 1170ccea 编写于 作者: J Jon Leighton

Removed ActiveSupport::SecureRandom in favour of SecureRandom from the...

Removed ActiveSupport::SecureRandom in favour of SecureRandom from the standard library. (It has been deprecated in the 3-1-stable branch.)
上级 d411c85a
*Rails 3.2.0 (unreleased)*
* Removed ActiveSupport::SecureRandom in favour of SecureRandom from the standard library [Jon Leighton]
*Rails 3.1.0 (unreleased)*
* Deprecated ActiveSupport::SecureRandom in favour of SecureRandom from the standard library [Jon Leighton]
* New reporting method Kernel#quietly. [fxn]
* Add String#inquiry as a convenience method for turning a string into a StringInquirer object [DHH]
......
......@@ -70,7 +70,6 @@ module ActiveSupport
autoload :OrderedHash
autoload :OrderedOptions
autoload :Rescuable
autoload :SecureRandom
autoload :StringInquirer
autoload :XmlMini
end
......
require 'active_support/secure_random'
require 'active_support/core_ext/module/delegation'
module ActiveSupport
......
require 'securerandom'
module ActiveSupport
# Use Ruby's SecureRandom library.
SecureRandom = ::SecureRandom # :nodoc:
end
require 'abstract_unit'
class SecureRandomTest < Test::Unit::TestCase
def test_random_bytes
b1 = SecureRandom.random_bytes(64)
b2 = SecureRandom.random_bytes(64)
assert_not_equal b1, b2
end
def test_hex
b1 = SecureRandom.hex(64)
b2 = SecureRandom.hex(64)
assert_not_equal b1, b2
end
def test_random_number
assert SecureRandom.random_number(5000) < 5000
end
end
require 'digest/md5'
require 'active_support/secure_random'
require 'securerandom'
require 'active_support/core_ext/string/strip'
require 'rails/version' unless defined?(Rails::VERSION)
require 'rbconfig'
......
......@@ -9,7 +9,7 @@ end
desc 'Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions).'
task :secret do
require 'active_support/secure_random'
require 'securerandom'
puts SecureRandom.hex(64)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册