Hash Generator (SHA-256 / SHA-512)
Generate cryptographic hashes using SHA-256 or SHA-512. All hashing runs in your browser via Web Crypto API.
What a Cryptographic Hash Does
A cryptographic hash function takes input of any length and produces a fixed-length output (the digest) with three key properties: deterministic (same input always produces the same hash), one-way (you can't reverse a hash back to the original input), and collision-resistant (different inputs should not produce the same hash). Even a single character change in the input produces a completely different hash — a property called the avalanche effect. These properties make hashes essential for verifying data integrity, storing passwords, signing software distributions, and generating unique identifiers for content.
SHA-256 vs SHA-512
SHA-256 produces a 256-bit (64 hex character) digest; SHA-512 produces a 512-bit (128 hex character) digest. Both are members of the SHA-2 family and are considered cryptographically secure. SHA-512 has a larger security margin, but SHA-256's 128-bit collision resistance already exceeds what's computationally feasible to attack. SHA-512 is faster than SHA-256 on 64-bit processors because its internal operations process 64-bit words. SHA-256 is faster on 32-bit systems and most microcontrollers. For practical use: SHA-256 for certificates (TLS, code signing), file integrity checks, and general purpose hashing. SHA-512 when extra margin is desired or when working on 64-bit servers processing large data volumes.
Hashing vs Encryption
Hashing is one-way — you cannot recover the original input from a hash. Encryption is two-way — data is encrypted with a key and can be decrypted with the correct key. This distinction matters for password storage: passwords should always be hashed (with a slow algorithm like bcrypt or Argon2, not SHA-256), never encrypted. An encrypted password database, if the key is compromised, exposes all passwords. A properly hashed password database requires attackers to crack each hash individually. SHA-256 is too fast for password hashing — use bcrypt, Argon2, or scrypt, which are designed to be computationally expensive for this specific purpose.
Common Applications
File integrity verification: software distributors publish SHA-256 hashes of downloads so users can verify the file wasn't modified in transit. Git uses SHA-1 (now transitioning to SHA-256) to identify every commit, tree, and blob by content hash. TLS certificates include hashes of the certificate content to detect tampering. Blockchain transactions are chained by including the previous block's hash. Content-addressable storage systems (IPFS, Nix) use SHA-256 to identify data by its content rather than its location. Digital signatures sign a hash of the message rather than the message itself, making signatures efficient regardless of message length.
Frequently Asked Questions
What is a hash function?
What is SHA-256 used for?
Should I use SHA-256 to store passwords?
Related Tools