Simple string hash — 13 fast non-cryptographic hashes side by side

Type any string to see thirteen fast, non-cryptographic hashes in one table, from djb2 and FNV-1a to MurmurHash3, xxHash32 and Java's String.hashCode(), each in hex and decimal.

Live demo · real result from this tool

Table

AlgorithmHexDecimal
djb2 (× 33 + c)0f923099261238937
djb2a (× 33 ^ c)0a9cede7178056679
sdbm28d19932684824882
FNV-1 32b6fa71673069866343
FNV-1a 324f9f2cab1335831723
Jenkins one-at-a-timec8fd181b3372029979
MurmurHash3 x86 32 (seed 0)248bfa47613153351
ELF / PJW006ec32f7258927
Java String.hashCode()05e918d299162322
xxHash32 (seed 0)fb0077f94211111929
CRC-323610a686907060870
Adler-32062c0215103547413
Lose-lose (byte sum)00000214532

13 rows — scroll inside the table, or download the CSV.

Fast, non-cryptographic hashes for hash tables, sharding and checksums. None of them resists deliberate collisions.

Processed on your device — nothing is uploaded.

How to use the simple string hash tool

  1. Type or paste your string into Text. The default is hello.
  2. Read the table. Each row has the Algorithm, the Hex value (8 digits) and the Decimal value.
  3. Copy the row that matches the function your program uses.

What it does and when to use it

Programs use small hash functions to put keys into hash tables, split work across servers, build bloom filters and create cache keys. When a value in your code looks wrong, it helps to see the expected result from several well-known functions at once. This page also makes a good teaching aid, because you can watch how one changed letter affects each function differently.

For a single algorithm with variants and raw-byte input, use the DJB2 calculator or the FNV hash calculator. For secure digests of many algorithms together, see hash all.

How it works

All rows except Java hash the UTF-8 bytes of your text. The functions are written in the page’s own code, except xxHash32, CRC-32 and Adler-32, which come from the hash-wasm library. All run in your browser.

Row Idea in one line
djb2 / djb2a start 5381; × 33, then add or XOR each byte
sdbm byte + (h « 6) + (h « 16) − h
FNV-1 / FNV-1a multiply by 16777619 and XOR, in either order
Jenkins one-at-a-time add, shift and XOR per byte, final mix
MurmurHash3 x86 32 4 bytes at a time, rotate-multiply mixing, seed 0
ELF / PJW shift by 4, fold the top bits back in
Java String.hashCode() h × 31 + UTF-16 code unit, signed
xxHash32 4-lane mixing, seed 0
CRC-32, Adler-32 standard checksums
Lose-lose plain sum of the bytes

Worked examples

hello. The tool shows Java String.hashCode() | 05e918d2 | 99162322, the same number Java prints for "hello".hashCode(). MurmurHash3 gives 248bfa47, djb2 gives 0f923099 and FNV-1a gives 4f9f2cab.

A famous Java collision. Aa and BB both give a Java hashCode of 2112 (00000840). In Aa, 65 × 31 + 97 = 2112; in BB, 66 × 31 + 66 = 2112. Their djb2 values differ (5862151 and 5862153), and the lose-lose sums are 162 and 132.

Empty text. The table shows each function’s starting state: djb2 5381, FNV 811c9dc5, Adler-32 1, xxHash32 02cc5d05, and 0 for most others.

Limits and tips

  • Bytes or characters matter. For é, Java hashes one UTF-16 unit (233), while the other rows hash two UTF-8 bytes.
  • Lose-lose is included as a bad example: every anagram, such as listen and silent, gets the same value.
  • Results are 32-bit. On 64-bit platforms some C versions of djb2 and sdbm keep more bits and differ for long strings.
  • There is no hex or Base64 input on this page; it always hashes the text as typed.

Frequently asked questions

Is this a Caesar cipher?
No. The page keeps an old name, but it computes hashes, not a cipher. For the letter-shift cipher see ROT13, which is a Caesar shift of 13.
Which hash should I pick for a hash table?
For speed and good spread, MurmurHash3 or xxHash32 are the usual choices. djb2 and FNV-1a are shorter to write and fine for small tables. If outsiders choose the keys, use a keyed hash such as SipHash, because all thirteen here can be attacked with crafted collisions.
Why is the Java value negative sometimes?
Java's hashCode is a signed 32-bit int. The Decimal column shows it signed, as Java prints it, while the Hex column shows the same 32 bits as unsigned.
Can any of these protect a password or prove a file is unchanged?
No. They are designed for speed, not security. Use bcrypt for passwords and SHA-256 for integrity.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close