class PEROBS::FNV_Hash_1a_64

This is an implementation of the Fowler Noll Vo hashing algorithm in the 1a variant for 64 bit hash values. en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function

Public Class Methods

digest(item) click to toggle source
# File lib/perobs/FNV_Hash_1a_64.rb, line 39
def self.digest(item)
  hash = @@OFFSET

  item.to_s.each_byte do |byte|
    hash ^= byte
    hash *= @@PRIME
    hash &= @@MASK
  end

  hash
end