vendor/bundle/ruby/2.5.0/gems/securecompare-1.0.0/lib/securecompare.rb
# constant-time comparison algorithm to prevent timing attacks; borrowed from ActiveSupport::MessageVerifier
constant-time comparison algorithm to prevent timing attacks; borrowed from ActiveSupport::MessageVerifier
constant - time comparison algorithm to prevent timing attacks ; borrowed from ActiveSupport :: MessageVerifier
def secure_compare(a, b)
    return false unless a.bytesize == b.bytesize
    l = a.unpack("C#{a.bytesize}")
    res = 0
    b.each_byte { |byte| res |= byte ^ l.shift }
    res == 0
  end
def secure_compare ( a , b ) return false unless a . bytesize == b . bytesize l = a . unpack ( "C#{a.bytesize}" ) res = 0 b . each_byte { | byte | res |= byte ^ l . shift } res == 0 end
constant-time comparison algorithm to prevent timing attacks; borrowed from ActiveSupport::MessageVerifier
constant - time comparison algorithm to prevent timing attacks ; borrowed from ActiveSupport :: MessageVerifier
a
<not_specific>
b
<not_specific>