Sha256: f885e7d04c35224fd535cca2c9b7611d2c4b0abdf9904e3fc657f3a24e73d9c0

Contents?: true

Size: 390 Bytes

Versions: 1

Compression:

Stored size: 390 Bytes

Contents

require 'openssl'

module WAEasyAPI
  # Helper functions are defined here
  class Utility
    class << self
      private

      def secure_compare(a, b)
        return false unless a.bytesize == b.bytesize

        l = a.unpack('C*')
        r = 0
        i = -1

        b.each_byte do |v|
          i += 1
          r |= v ^ l[i]
        end

        r.zero?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
waeasyapi-1.0.0 lib/waeasyapi/utility.rb