Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes from text or files. Supports HMAC authentication codes. Everything runs locally in your browser — no data is uploaded.
Hash will appear here…Why use our online Hash Generator?
Compute cryptographic hash digests (MD5, SHA-1, SHA-256, SHA-512) for any string directly in your browser. Useful for verifying data integrity, debugging checksums, and testing hash functions.
How to use Hash Generator
- 1Enter the text to hash
Click the Text tab and type or paste the content you want to hash. The hash updates automatically as you type.
- 2Choose an algorithm
Select MD5, SHA-1, SHA-256, or SHA-512 from the algorithm toggle. Each algorithm produces a different-length output: MD5=32 hex chars, SHA-1=40, SHA-256=64, SHA-512=128.
- 3Hash a file instead
Switch to the File tab, then drag and drop a file or click to browse. The tool reads the file locally and computes its hash — nothing is uploaded.
- 4Generate an HMAC
Enable the HMAC toggle and enter a secret key to compute an authentication code. HMAC is used to verify both the integrity and authenticity of a message.
- 5Copy the hash output
Click the Copy button to copy the hash string to your clipboard. The output is always lowercase hex.
Hash function properties — what makes a good hash
A cryptographic hash function must satisfy four essential properties to be considered secure.
Deterministic: the same input always produces the same output. This is essential for the verification use case — if hashes were random, you couldn't confirm a file hadn't changed.
Pre-image resistance: given a hash output, it must be computationally infeasible to find any input that produces that hash. This is what makes hashes one-way — you cannot reverse a SHA-256 hash to find the original data.
Second pre-image resistance: given an input and its hash, it must be computationally infeasible to find a different input with the same hash. This prevents an attacker from substituting a malicious file that has the same hash as a trusted file.
Collision resistance: it must be computationally infeasible to find any two different inputs that produce the same hash. This is a stronger property than second pre-image resistance — it requires that no collision can be found at all, not just that a specific input can't be matched.
MD5 and SHA-1 have been broken for collision resistance: researchers can produce collisions on consumer hardware. They remain useful for checksums where collision attacks are not a concern (detecting accidental corruption), but must not be used for security purposes.
Practical uses for file hashing
Hashing a file produces a unique fingerprint that enables several practical applications.
Download integrity verification: open-source projects and software vendors publish SHA-256 hashes alongside downloads. After downloading, you hash the file and compare the result to the published hash. If they match, the file was not corrupted in transit and has not been tampered with. If they differ, discard the download and try again.
Deduplication: storage systems use hashing to identify duplicate files. If two files have the same SHA-256 hash, they are (with overwhelming statistical certainty) identical, and only one copy needs to be stored. Git uses SHA-1 hashing to identify objects (commits, trees, blobs) and detect duplicates.
Change detection: monitoring systems hash configuration files or critical system files periodically. Any change to a file produces a different hash, triggering an alert. This is the principle behind file integrity monitoring tools (Tripwire, OSSEC, AIDE) used in security operations.
Content-addressed storage: instead of naming files by path, systems like IPFS, Git objects, and many caches identify content by its hash. This makes content immutable and enables efficient caching and sharing — if you request a hash you already have, you don't need to fetch it again.
HMAC authentication — how it works and where it's used
HMAC (Hash-based Message Authentication Code) combines a hash function with a secret key to produce a code that authenticates both the content and the sender. Unlike a plain hash, which anyone can compute, an HMAC can only be computed by someone who knows the secret key.
The HMAC formula: HMAC(K, M) = H((K ⊕ opad) || H((K ⊕ ipad) || M)), where H is the hash function, K is the key, M is the message, opad and ipad are fixed padding constants. This double-hash structure provides protection against length extension attacks that affect plain hash authentication.
Real-world uses: AWS API request signing uses HMAC-SHA256 to authenticate every API call — the signature in the Authorization header is an HMAC of the canonical request string with your AWS secret key. Webhook providers (Stripe, GitHub, Twilio) include an HMAC signature in webhook request headers so recipients can verify the request came from the legitimate source. JWT tokens using HS256 use HMAC-SHA256 to sign the header and payload.
HMAC is not encryption — it does not hide the message content. It only proves authenticity and integrity. For confidentiality, combine HMAC with encryption (or use an authenticated encryption mode like AES-GCM that provides both simultaneously).
Frequently Asked Questions
What is the difference between MD5, SHA-1, SHA-256, and SHA-512?
- MD5 produces a 128-bit (32 hex character) hash and is fast but cryptographically broken — do not use it for security purposes. SHA-1 produces 160 bits (40 characters) and is also deprecated for security use. SHA-256 (256 bits, 64 characters) and SHA-512 (512 bits, 128 characters) are part of the SHA-2 family and remain secure for most uses. SHA-256 is the current industry standard for checksums and digital signatures.
Can I use MD5 or SHA-1 for password hashing?
- No. MD5 and SHA-1 are too fast for password storage — attackers can brute-force billions of guesses per second using GPUs. Use a slow, password-specific algorithm like bcrypt, scrypt, or Argon2 instead. This tool is intended for checksums, data integrity checks, and educational use.
What is HMAC and when should I use it?
- HMAC (Hash-based Message Authentication Code) combines a cryptographic hash function with a secret key. Unlike a plain hash, HMAC proves both that the data has not been tampered with AND that it came from someone who knows the secret key. It is used in API authentication (e.g., AWS Signature), JWT signing, and webhook verification.
Is my data private when I use this tool?
- Yes. All hashing happens entirely in your browser. Text is hashed using the Web Crypto API and js-md5 library — nothing leaves your device. File hashing also happens locally; files are never uploaded.
Why does the same input always produce the same hash?
- Hash functions are deterministic — the same input always produces the same output. This property makes them useful for verifying file integrity. Even a single character change completely changes the output (avalanche effect). The only way to get the same hash is to have identical input.
Related Tools
UUID Generator
Generate random UUID v4 identifiers. Bulk generate up to 100 UUIDs, toggle uppercase/lowercase and hyphen formatting.
Base64
Encode and decode Base64 strings instantly.
JWT Decoder
Decode and inspect JWT tokens — header, payload, timestamps.
Password Gen
Highly secure, random entropy generation.
SEO Audit
Audit any URL's on-page SEO — meta tags, headings, images, links, schema, Open Graph, and Twitter Cards in seconds.