require_relative '../data_conversion' module Ccrypto module Java class ComparatorUtil extend DataConversion def self.is_equal?(val1, val2) bval1 = to_java_bytes(val1) bval2 = to_java_bytes(val2) if bval1.length != bval2.length false else res = 0 (0...bval1.length).each do |i| res |= bval1[i] ^ bval2[i] end res == 0 end #bval1 == bval2 #logger.debug "bval1 : #{bval1.inspect}" #logger.debug "bval2 : #{bval2.inspect}" end class << self alias_method :is_equals?, :is_equal? alias_method :equals?, :is_equal? alias_method :equal?, :is_equal? end #self.singleton_class.alias_method :is_equals?, :is_equal? private def logger Ccrypto::Java.logger(:comparator) end end end end