class CrystalFnv::Hash

Defined in:

crystal_fnv.cr

Constant Summary

MASK = {32 => 4294967295_i64, 64 => 18446744073709551615_u64}
OFFSET_BASIS = {32 => 2166136261_i64, 64 => 14695981039346656037_u64}
PRIME = {32 => 16777619, 64 => 1099511628211_i64}

Class Method Summary

Class Method Detail

def self.fnv_1(item, size = 32) #

Calculates the FNV-1 hash for the given item value

@param item The item to hash @param size [Integer] the size of the resulting hash

@return [Integer] the calculated hash value


[View source]
def self.fnv_1a(item, size = 32) #

Calculates the FNV-1a hash for the given item value

@param item The item to hash @param size [Integer] the size of the resulting hash

@return [Integer] the calculated hash value


[View source]