Générateur de hachage
Générez des hachages cryptographiques MD5, SHA-1, SHA-256 et SHA-512 à partir de n'importe quel texte du navigateur. Il s'exécute entièrement dans votre navigateur — aucune donnée n'est envoyée à aucun serveur, aucun compte n'est requis, et c'est entièrement gratuit.
The Complete Guide to Cryptographic Hash Functions
Cryptographic hash functions are the silent workhorses of modern internet security. They protect your passwords in databases, verify the integrity of software downloads, power blockchain networks, and authenticate digital communications. Despite their fundamental importance, they are often poorly understood — and misused. This guide explains what hash functions are, how the most common algorithms (MD5, SHA-1, SHA-256, SHA-512) differ, and when to use each one.
What is a Cryptographic Hash Function?
A cryptographic hash function is a mathematical algorithm that takes an input of any size and produces a fixed-size output string called a hash, digest, or checksum. The key properties that make a function "cryptographic" are:
- Deterministic: The same input always produces the exact same hash output. Hash("hello") will always equal the same 64-character string.
- One-way (Pre-image Resistance): Given only the hash output, it is computationally infeasible to determine what the original input was. You cannot "reverse" a hash.
- Avalanche Effect: A tiny change in the input produces a completely different, unpredictable hash. Changing a single character changes approximately 50% of the output bits.
- Collision Resistance: It should be computationally infeasible to find two different inputs that produce the same hash output. (Note: some older algorithms like MD5 and SHA-1 have had collisions demonstrated.)
- Fixed Output Length: Regardless of whether the input is 1 byte or 1 gigabyte, the output is always the same fixed length for a given algorithm.
The Major Hash Algorithms Compared
MD5 (Message Digest 5)
MD5 produces a 128-bit (16-byte) hash, typically displayed as a 32-character hexadecimal string. Developed by Ronald Rivest in 1991, MD5 was once the dominant hashing algorithm for security applications.
Status: Broken for security purposes. In 2004, researchers demonstrated practical MD5 collision attacks. In 2008, a team created a rogue CA certificate using an MD5 collision. MD5 is no longer acceptable for any security-sensitive application.
Still useful for: Non-security checksums (verifying file downloads didn't get corrupted in transit), database deduplication, hash-table keys in non-security contexts, legacy system compatibility.
SHA-1 (Secure Hash Algorithm 1)
SHA-1 produces a 160-bit (20-byte) hash, displayed as a 40-character hex string. Developed by the NSA and published by NIST in 1995, SHA-1 replaced MD5 as the standard for decades.
Status: Deprecated for security purposes. In 2017, Google's Project Zero produced the first practical SHA-1 collision (the "SHAttered" attack). All major browser vendors and certificate authorities stopped trusting SHA-1 certificates in 2017.
Still seen in: Legacy Git repository object storage (Git is transitioning to SHA-256), older TLS/SSL certificates, some legacy authentication systems.
SHA-256 (SHA-2 Family)
SHA-256 produces a 256-bit (32-byte) hash, displayed as a 64-character hex string. Part of the SHA-2 family designed by the NSA and published by NIST in 2001.
Status: The current gold standard. No practical attacks have been demonstrated against SHA-256. It is mathematically secure against all known classical computing attacks.
Used in: Bitcoin and most blockchain networks (double SHA-256 for block hashing), TLS/SSL certificates (replacing SHA-1), file integrity verification, HMAC authentication signatures, password hashing (combined with bcrypt/argon2 internally), digital signatures (RSA-SHA256, ECDSA-SHA256), X.509 certificates.
SHA-512 (SHA-2 Family)
SHA-512 produces a 512-bit (64-byte) hash, displayed as a 128-character hex string.
Status: Equally secure to SHA-256, but slower on 32-bit systems. On 64-bit processors, SHA-512 can actually be faster than SHA-256 because 64-bit CPUs natively handle the 64-bit word operations SHA-512 uses internally.
Used in: High-security applications where longer digest length is preferred, Unix/Linux password hashing (SHA-512 is the default algorithm in /etc/shadow), Ethereum (uses Keccak-512, a SHA-3 variant), archive integrity verification.
Important: Hash Functions Are NOT for Password Storage
This is a critical distinction that trips up many developers. Raw cryptographic hash functions (SHA-256, bcrypt, MD5) should never be used directly to store user passwords in a database. Here's why:
SHA-256 and similar algorithms are designed to be fast. This is great for integrity verification, but catastrophic for passwords. A modern GPU can compute billions of SHA-256 hashes per second. An attacker who steals your database can run a massive dictionary attack — hashing millions of common passwords per second — and crack most user passwords in hours.
For password storage, always use a slow, adaptive, salted hashing function specifically designed for this purpose:
- bcrypt: The industry standard for most web applications. Built-in work factor (cost factor) that makes it progressively slower. Available in every major language.
- Argon2: The winner of the 2015 Password Hashing Competition. Preferred for new applications. Resistant to both GPU and ASIC attacks.
- scrypt: Memory-hard function that makes large-scale parallel attacks expensive. Used by Litecoin and some Unix systems.
Use our free Hash Generator for file integrity verification, checksums, and developer testing. Always use bcrypt or argon2 for password hashing in production systems.
Comment utiliser le Générateur de hachage
- 1
Enter text to hash
Type or paste the text (password, file content, message, etc.) that you want to hash.
- 2
Click Generate Hashes
The tool simultaneously calculates MD5, SHA-1, SHA-256, and SHA-512 hashes.
- 3
Copy any hash
Click Copy next to the hash algorithm you need. Each hash is shown in lowercase hexadecimal format.
Foire Aux Questions
What is a cryptographic hash?
A hash function takes any input and produces a fixed-length string of characters. The same input always produces the same hash, but even a tiny change in input produces a completely different hash. Hashes are one-way — you cannot recover the original input from the hash.
What is SHA-256 used for?
SHA-256 is the gold standard for data integrity verification, file checksums, digital signatures, and blockchain (Bitcoin uses SHA-256). It is recommended over SHA-1 and MD5 for security-sensitive applications.
Is MD5 still secure?
MD5 is no longer considered cryptographically secure for security purposes — collisions have been demonstrated. However, it is still widely used for non-security checksums (e.g., verifying file downloads did not corrupt). Use SHA-256 for any security-sensitive hashing.
How is hashing done — is it on the server?
SHA-1, SHA-256, and SHA-512 are computed using the browser's built-in Web Crypto API (crypto.subtle.digest). MD5 uses the crypto-js library. All computation is local — nothing leaves your browser.
Can I hash a password with this tool?
This tool shows raw hashes which are NOT suitable for password storage. Password storage requires a slow, salted hashing algorithm like bcrypt, argon2, or scrypt. Use this tool for checksums and integrity verification, not password hashing.