User Tools

Site Tools


This shows you the differences between two versions of the page.

Link to this comparison view

fowler_noll_vo_hash_function [2015/02/02 08:28] (current)
Line 1: Line 1:
 +====== Fowler Noll Vo hash function ======
 +Fowler–Noll–Vo is a non-cryptographic hash function created by Glenn Fowler, Landon Curt Noll, and Phong Vo.
 +It is very simple to implement, and very fast. The FNV hash can come in several different sizes, 32-, 64-, 128-bit etc. See [http://​​chongo/​tech/​comp/​fnv/​index.html] for more information.
 +There are two versions of the hash, FNV-1 and FNV-1a. For all purposes the FNV-1a hash is recommended.
 +The basic algorithm of the FNV-1a hash is:
 +  - hash = FNV_offset_basis
 +  - for each octet_of_data to be hashed
 +    - hash = hash XOR octet_of_data
 +    - hash = hash $\times$ FNV_prime
 +  - return hash
 +===== Javascript=====
 +Javascript makes implementation trickier by only providing [[Javascript math|math]] via floating point doubles. However 32-bit integers can be represented without data loss. Another aspect of Javascript to watch out for is that ''​String.charCodeAt''​ returns a 16-bit value and so has to be treated as two octets/​bytes of data.
 +This implementation is the 32-bit FNV-1a hash.
 +[algorithm Fowler Noll Vo hash-string]
fowler_noll_vo_hash_function.txt · Last modified: 2015/02/02 08:28 (external edit)