module EventMachine::Protocols::Couchbase::Util

Constants

CRC32TAB

Public Class Methods

crc32_hash(key) click to toggle source
# File lib/em-couchbase/util.rb, line 83
def self.crc32_hash(key)
  crc = 2 ** 32 - 1
  key.bytes.each do |ch|
    crc = (crc >> 8) ^ CRC32TAB[(crc ^ ch) & 0xff]
  end
  return ((~crc) >> 16) & 0x7fff
end