module
Crypto::Subtle
Defined in:
crypto/subtle.crClass Method Summary
- .constant_time_byte_eq(x, y)
-
.constant_time_compare(x, y) : Bool
Comparesx andy in constant time and returns
trueif they are the same, andfalseif they are not.
Class Method Detail
Comparesx andy in constant time and returnstrue if they are the same, andfalse if they are not.
require "crypto/subtle"
Crypto::Subtle.constant_time_compare("foo", "bar") # => false
Crypto::Subtle.constant_time_compare("foo", "foo") # => true
NOTE x andy must be able to respond toto_slice.