Fnv hash generator

This fnv hash generator support 5000 characters , if the text is more than 5000 characters, the text will be trim to 5000 characters

fnv hash generator


Please select the hash algorithm and type the string you want to encode below

Current characters count is

please wait

The full name of fnv hash algorithm is Fowler-Noll-Vo

fnv hash algorithm is a non-cryptographic hash function developed by Glenn Fowler, Landon Curt Noll, and Kiem-Phong Vo.

There are 2 versions of fnv algorithm, FNV-1 and FNV-1a,FNV has 32-, 64-, 128-, 256-, 512-, and 1024-bit versions.

FNV is not a cryptographic hash., it is designed for fast hash table and checksum use

FNV algorithm is very simple to implement

The history of FNV hash algorithm

The FNV hash algorithm come from a review comment which is send to the IEEE POSIX P1003.2 committee, which is from Glenn Fowler and Phong Vo in 1991.

Landon Curt Noll further improved the hash algorithm so the final author is 3 people.

The hash algorithm is finally named Fowler/Noll/Vo or FNV hash is in a email which is send to Landon.

Two different of FNV hash

There are 2 versions of FNV hash ,they are FNV-1 and FNV-1a hash , the FNV-1a hash can create non-zero FNV offset basis. FNV hash contain several type of bit flavors. Such as 32-, 64-, 128-, 256-, 512-, and 1024-bit flavors.

For the vanilla FNV hash implementations ,the bit flavor is defined by the availability of the FNV primes for the desired bit length.

In the official FNV webpage, someone is discussing the way of change the bit length to a smaller length which may be or not be the a power of two

The implementation of FNV hash

The FNV hash algorithms and it’s original implantation source code is released to the public long time ago

The fnv hash is quite simple to implement. Begin with an initial hash value of FNV offset basis.for every byte in the hash input , multiply hash by the FNV prime, and then XOR it with the byte from the input. In the FNV-1a hash algorithm you reverses the action of the multiply and XOR steps.

The detail implementation of FNV 1 hash

The fnv 1 hash implementation is as follows

hash = FNV_offset_basis
for each byte_of_data to be hashed
hash = hash × FNV_prime
hash = hash XOR byte_of_data
return hash

in the code section ,all the variables are unsigned integers. All the variables except the byte_of_data have the same length of bits as the FNV hash, the byte_of_data variable is an 8 bit unsigned integer.

If we want to calculate an 32 bit FNV 1 hash .then :

  • All variables except the byte_of_data, are 32-bit unsigned integers
  • The FNV_offset_basis is the 32 bit FNV offset basis value:
  • The FNV_prime is the 32-bit FNV prime
  • The multiply returns the lower 32-bits of the product
  • The XOR is an 8-bit operation that modifies only the lower 8-bits of the hash value
  • The hash value returned is a 32-bit unsigned integer

The detail implementation of The FNV 1a hash

The FNV 1a name is call 1a because the difference between the FNV 1a hash and the FNV hash is only the order in which the multiply and XOR is calculated

The pseudo code is
hash = FNV_offset_basis
for each byte_of_data to be hashed
hash = hash XOR byte_of_data
hash = hash × FNV_prime
return hash

the above code has been changed to leads to slightly better avalanche characteristics.

Fnv is a non cryptographic hash

The fnv hash algorithm is designed for quick hash table check , not for cryptographyThe proper properties for a cryptographic hash function should contain

Quick speed of computation,: FNV 1 hash was designed for use as checksum and hashtable , so the speed of fnv 1 hash algorithm is quite fast . but the same quick speed also cause finding specific hash values (collisions) by brute force method more easily( faster).

Sticky State – the fnv 1 hash is an iterative hash based primarily on XOR and multiplication, the fnv 1 hash algorithm is sensitive to the number zero.
In the satiation , if the hash value were to become zero at any point during calculation, and the next byte hashed were also all zeroes, the hash value will not change , this makes

colliding messages trivial to create given a message that will results into a hash which value of zero at some point in its calculation. Additional operations ,for example the addition of a third constant prime on vevry step, can mitigate this but cab also have detrimental effects on avalanche effect or random distribution of the final hash values.

Diffusion – The best theoretical secure hash function is a hash function which each byte of input has an equally-complex effect on every bit of the hash.

In the FNV hash, the ones place (the rightmost bit) is always the XOR of the rightmost bit of each input byte.This can be mitigated by XOR-folding (computing a hash twice the desired length, and then XORing the bits in the “upper half” with the bits in the “lower half”).