module CRC16

taken from www.hadermann.be/blog/32/ruby-crc16-implementation/

Constants

CCITT_16

Public Class Methods

crc16(buf, crc=0xffff) click to toggle source
# File lib/ruby-sml/crc16.rb, line 5
def self.crc16(buf, crc=0xffff)
  buf.each_byte{|x| crc = (crc >> 8) ^ CCITT_16[(crc ^ x) & 0xff]}
  return crc
end