aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2019-03-28 02:33:10 +1030
committerGitHub <noreply@github.com>2019-03-28 02:33:10 +1030
commit0223665c971b98fe0ac82b78b485ee1330d4c1e3 (patch)
tree66ff1ada50cd24d4cf5a85e4722eb0c6c6b8d9c9
parent3c2f3010785d8061415dbb3bac04be312123b931 (diff)
parentc76a8c72d550734fc55877deecba0bf5dcc63c17 (diff)
downloadrails-0223665c971b98fe0ac82b78b485ee1330d4c1e3.tar.gz
rails-0223665c971b98fe0ac82b78b485ee1330d4c1e3.tar.bz2
rails-0223665c971b98fe0ac82b78b485ee1330d4c1e3.zip
Merge pull request #35556 from bdewater/fast-secure-compare
Stop encoding in secure_compare for speedup
-rw-r--r--activesupport/lib/active_support/security_utils.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/security_utils.rb b/activesupport/lib/active_support/security_utils.rb
index 20b6b9cd3f..5e455fca57 100644
--- a/activesupport/lib/active_support/security_utils.rb
+++ b/activesupport/lib/active_support/security_utils.rb
@@ -24,7 +24,7 @@ module ActiveSupport
# The values are first processed by SHA256, so that we don't leak length info
# via timing attacks.
def secure_compare(a, b)
- fixed_length_secure_compare(::Digest::SHA256.hexdigest(a), ::Digest::SHA256.hexdigest(b)) && a == b
+ fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b
end
module_function :secure_compare
end