class Avro::Schema
Constants
- CRC_EMPTY
Public Instance Methods
crc_64_avro_fingerprint()
click to toggle source
# File lib/ext/avro_patches.rb, line 24 def crc_64_avro_fingerprint parsing_form = Avro::SchemaNormalization.to_parsing_form(self) data_bytes = parsing_form.unpack("C*") initFPTable unless @@fp_table fp = CRC_EMPTY data_bytes.each do |b| fp = (fp >> 8) ^ @@fp_table[ (fp ^ b) & 0xff ] end fp end
initFPTable()
click to toggle source
# File lib/ext/avro_patches.rb, line 13 def initFPTable @@fp_table = Array.new(256) 256.times do |i| fp = i 8.times do |j| fp = (fp >> 1) ^ ( CRC_EMPTY & -( fp & 1 ) ) end @@fp_table[i] = fp end end