Created
September 7, 2009 03:06
-
-
Save speedmax/182118 to your computer and use it in GitHub Desktop.
money patch rails to fix bug #3144
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveSupport | |
class MessageVerifier | |
private | |
# constant-time comparison algorithm to prevent timing attacks | |
def secure_compare(a, b) | |
if a.respond_to?(:bytes) | |
a.bytes.to_a == b.bytes.to_a | |
else | |
a.to_a == b.to_a | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment