Hash Generator — MD5, SHA-256 and Cryptographic Hashing Explained
A cryptographic hash function is a mathematical algorithm that maps data of any size to a fixed-size output (called a hash, digest, or checksum). It is a one-way function — you can generate a hash from data, but you cannot reverse a hash back to the original data.
Common Hash Algorithms
- MD5 (128-bit): Fast but cryptographically broken. Should not be used for security-sensitive applications. Still useful for file checksums and data fingerprinting where security is not critical.
- SHA-1 (160-bit): Also considered weak against deliberate attacks since 2017. Deprecated for most security uses.
- SHA-256 (256-bit): Part of the SHA-2 family. Currently considered secure and widely used for password hashing, digital signatures, and SSL certificates.
- SHA-512 (512-bit): More secure than SHA-256, slower but provides higher security margin. Used in financial applications.
- CRC32: Not cryptographic — used for error detection in files and networks, not security.
Properties of Hash Functions
- Deterministic: The same input always produces the same hash.
- One-way: Impossible to reconstruct the original data from the hash.
- Avalanche effect: A tiny change in input creates a completely different hash.
- Fixed output: Output is always the same length regardless of input size.
Practical Uses of Hashing
- Password Storage: Never store passwords in plain text. Store the hash. (Use bcrypt or Argon2 for passwords, not MD5!)
- File Integrity: Compare file hashes before and after download to ensure the file was not corrupted or tampered with.
- Digital Signatures: Sign the hash of a document rather than the entire document.
- Blockchain: Bitcoin and Ethereum use SHA-256 for block hashing.