Home All Algorithms File Hash bcrypt Verify Hash Blog MD5 SHA-1 SHA-256 SHA-512 FAQ More Tools
100% Client-Side — Your text never leaves your browser

DJB2 Hash Generator

DJB2 (Dan Bernstein hash 2) is a simple non-cryptographic hash function popularized by Daniel J. Bernstein. It starts from 5381 and for each byte computes hash * 33 + byte. DJB2 is...

Input Text
Drop a file here, or click to browse
DJB2 hash computed locally — file never leaves your device
Any file type · Tested up to ~500 MB
filename.ext
size: 0 B
Reading…0%
Copy the DJB2 hash value
What is DJB2?

DJB2 (Dan Bernstein hash 2) is a simple non-cryptographic hash function popularized by Daniel J. Bernstein. It starts from 5381 and for each byte computes hash * 33 + byte. DJB2 is extremely simple to implement, fast, and produces good distribution for string inputs. It is commonly used in basic hash map implementations.

⚠ IMPORTANT
  • DJB2 is NOT cryptographically secure.
  • Do not use for security, passwords, or tamper detection.
When to Use DJB2

Simple hash maps

DJB2 is a classic choice for basic hash map implementations due to its simplicity.

String fingerprinting

Quickly generating a short identifier for a string for lookup purposes.

Educational use

Often used to teach hash function concepts due to its simplicity.

Frequently asked questions
What is DJB2 hash and what is it used for?
DJB2 is a simple, fast non-cryptographic hash function created by Dan Bernstein. It uses the constant 5381 as the initial hash value and the multiplier 33 (computed as hash * 33 + c, often implemented as ((hash << 5) + hash) + c for speed). DJB2 is commonly used in hash tables, symbol tables in compilers, and simple string hashing where speed matters more than cryptographic strength.
How do I generate a DJB2 hash online?
Type or paste your text into the input box on this page. The 8-character hex DJB2 hash appears instantly, computed in your browser.
Is DJB2 cryptographically secure?
No. DJB2 is a non-cryptographic hash designed for speed and simplicity. Collisions are easy to find, and the function is reversible. It should never be used for passwords, signatures, or security purposes. For security applications, use SHA-256 or HMAC-SHA-256.
How fast is DJB2?
DJB2 is one of the fastest hash functions in software — typically 1-3 GB/s on a modern CPU. The core operation `hash = hash * 33 + c` can be optimized to a shift-add-add sequence that modern CPUs execute in just a few cycles per byte. Its simplicity and speed make it a popular choice for hash tables and symbol tables.
DJB2 vs FNV-1a: which is better?
Both are extremely fast non-cryptographic hashes with similar performance characteristics. FNV-1a generally has slightly better distribution on real-world inputs because XOR-then-multiply mixes bits more thoroughly than DJB2's multiply-then-add. DJB2 is even simpler to implement. For new code, FNV-1a is often preferred; for legacy compatibility or extreme simplicity, DJB2 is fine.
Where is DJB2 used?
DJB2 is used in: GNU symbol tables (the original use), simple hash tables in C and C++ libraries, educational examples (it is often the first hash function taught due to its simplicity), and quick string-to-bucket mapping in various scripting languages and tools.
How long is a DJB2 hash?
DJB2 produces a 32-bit value, displayed as 8 hexadecimal characters. The 32-bit version is the most common; 64-bit variants exist (using the constants 5381 and 33 with 64-bit arithmetic) but are less standardized.

Need More Hash Algorithms?

Generate MD5, SHA-256, SHA-512, CRC32 and 6 more — all at once on our main tool.

Our Network