C Example: FNV-1a Hash: 32-bit string fingerprints and avalanche effect

🗓 Last updated: 2026-11-30👤 Written by: Ivy✓ Reviewed by: MOTO🏷 Category: Encoding & Conversion

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.

⚡ Intermediate Reference entries: kw-unsignedfn-strlenkw-char
🖥 Run OnlineGCC 10.2 · C11 standard · click ▶ to run · Copy code
🖨 Reference OutputMatches the online run in a standard C11 environment
C · GCC 10.2 · -std=c11
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

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏