diff --git a/lib/i18n/backend/cache.rb b/lib/i18n/backend/cache.rb index 41b58fc2..9f862169 100644 --- a/lib/i18n/backend/cache.rb +++ b/lib/i18n/backend/cache.rb @@ -21,7 +21,7 @@ # configure your own digest method via which responds to #hexdigest (see # http://ruby-doc.org/stdlib/libdoc/digest/rdoc/index.html): # -# I18n.cache_key_digest = Digest::MD5.new +# I18n.cache_key_digest = OpenSSL::Digest::SHA256.new # # If you use a lambda as a default value in your translation like this: # diff --git a/lib/i18n/backend/cache_file.rb b/lib/i18n/backend/cache_file.rb index 4dafb3e6..0c5e1922 100644 --- a/lib/i18n/backend/cache_file.rb +++ b/lib/i18n/backend/cache_file.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'digest/sha2' +require 'openssl' module I18n module Backend @@ -19,7 +19,7 @@ def load_file(filename) key = I18n::Backend::Flatten.escape_default_separator(normalized_path(filename)) old_mtime, old_digest = initialized && lookup(:i18n, key, :load_file) return if (mtime = File.mtime(filename).to_i) == old_mtime || - (digest = Digest::SHA2.file(filename).hexdigest) == old_digest + (digest = OpenSSL::Digest::SHA256.file(filename).hexdigest) == old_digest super store_translations(:i18n, load_file: { key => [mtime, digest] }) end