C Example: FNV-1a Hash: 32-bit string fingerprints and avalanche effect
Implements the classic 32-bit FNV-1a hash: XOR each byte then multiply by the FNV prime, printing an 8-digit hex fingerprint. Hashes six strings, then compares two inputs differing by one character and counts how many bits changed — a direct look at the avalanche effect.
🖥 Run OnlineGCC 10.2 · C11 standard · click ▶ to run · Copy code
🖨 Reference OutputMatches the online run in a standard C11 environment
hello 0x4f9f2cab world 0x37a3e893 hello world 0xd58b3fa7 web-tutorial.com 0xa5ff955d C language 0xeb12f594 c language 0x49d97374 hash me -> 0x8d6ba0bd hash mf -> 0x8a6b9c04 differing bits: 12 of 32
🧩 Keep Learning