Fowler-Noll-Vo FNV1-64 Hash Code Calculator
Published: February 10, 2025 at 4:34:17 PM UTC
Hash code calculator that uses the Fowler-Noll-Vo 1 64 bit (FNV1-64) hash function to calculate a hash code based on text input or file upload.The FNV-1 64-bit hash function is part of the Fowler–Noll–Vo (FNV) family of hash functions, designed for fast hashing while maintaining a good distribution of hash values. It is commonly used in applications like hash tables, checksums, and data lookups. It produces a 64 bit (8 byte) hash code, often represented as a 16 digit hexadecimal number.
Full disclosure: I did not write the specific implementation of the hash function used on this page. It is a standard function included with the PHP programming language. I only made the web interface to make it publicly available here for convenience.
About the Fowler-Noll-Vo FNV-1 64 bit Hash Algorithm
I'm not a mathematician, but I'll try to explain this hash function using an analogy that my fellow non-mathematicians can understand. If you prefer a scientifically correct, scary-math explanation, I'm sure you can find that elsewhere ;-)
First, let's think of the FNV-1 algorithm like a recipe for making a special smoothie. Each ingredient you add (like fruits, milk, or honey) represents a piece of data - like letters, numbers, or even an entire file.
Now, the goal is to mix these ingredients in a very specific way so that even the tiniest change in the recipe (like adding one extra blueberry) makes the smoothie taste completely different. That's how hash functions work - they create a unique "flavor" (or hash value) for every unique set of ingredients (or input data).
The way the FNV-1 algorithm does this is a multi-step process:
Step 1: Start with a Base (Offset Basis)
Think of this like pouring a special smoothie base into your blender. This base is always the same, no matter what ingredients you add. In FNV-1, this is called the "offset basis" - just a fancy starting number.
Step 2: Add Ingredients One by One (Processing Data)
Now you start adding your ingredients, one at a time - let's say a strawberry, then a banana, then some honey. Each of these represents a byte of data.
Step 3: Blend with a Secret Multiplier (The FNV Prime)
After adding each ingredient, you hit the blend button, but here's the twist: the blender multiplies everything by a secret "magic number" called the FNV prime. This helps mix things up really well.
Step 4: Add a Dash of Magic (XOR Operation)
Before adding the next ingredient, you sprinkle in a little magic dust (this is the XOR operation). It's like flipping the flavor in unexpected ways, ensuring even small changes make a big difference.
Step 5: Repeat Until Done
You keep blending and sprinkling magic after each new ingredient until you've processed everything.
Step 6: Final Smoothie (Hash Value)
When you're done, you pour out the smoothie. The final taste (the hash value) is unique to that exact combination of ingredients. If you had added even one extra blueberry, it would taste completely different.
The version presented here is the original FNV-1 64 bit version. There is also an improved FNV-1a 64 bit version available: Fowler-Noll-Vo FNV1a-64 Hash Code Calculator