diff options
-rw-r--r-- | railties/lib/rails_generator/secret_key_generator.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/railties/lib/rails_generator/secret_key_generator.rb b/railties/lib/rails_generator/secret_key_generator.rb index 801b33c761..64fbbb90f8 100644 --- a/railties/lib/rails_generator/secret_key_generator.rb +++ b/railties/lib/rails_generator/secret_key_generator.rb @@ -76,7 +76,12 @@ module Rails OpenSSL::Random.seed(rand(0).to_s + Time.now.usec.to_s) end data = OpenSSL::BN.rand(2048, -1, false).to_s - return OpenSSL::Digest::SHA512.new(data).hexdigest + + if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00908000 + OpenSSL::Digest::SHA512.new(data).hexdigest + else + generate_secret_with_prng + end end # Generate a random secret key with /dev/urandom. |