Sha256: 5c7c9c6089d8301cdf4d06df95de3fc8316416f18c784a57ba75f5a7af9c011b
Contents?: true
Size: 799 Bytes
Versions: 3
Compression:
Stored size: 799 Bytes
Contents
module GoogleSafeBrowsing class BinaryHelper def self.read_bytes_as_hex(iter, count) read_bytes_from(iter, count).unpack("H#{count * 2}")[0] end def self.four_as_hex(string) string.unpack('H8')[0] end def self.read_bytes_from(iter, count) ret = '' count.to_i.times { ret << iter.next } ret #rescue # puts "Tried to read past chunk iterator++++++++++++++++++++++++++++++++++++++++++++++++++++++++" # return nil end def self.unpack_host_key(bin) bin.unpack('H8')[0] end def self.unpack_count(bin) # this may not be correct bin.unpack('U')[0] end def self.unpack_add_chunk_num(bin) bin.unpack('N')[0] end def self.hex_to_bin(hex) hex.to_a.pack('H*') end end end
Version data entries
3 entries across 3 versions & 1 rubygems