Published on March 17, 2026
A hash function turns input (a password, file, or any data) into a fixed-length string of characters. Same input always gives the same hash. The important part: you cannot reverse it. There is no "decrypt" for a hash. That is why hashes are used for passwords: you store the hash, and when the user logs in you hash their input and compare. If it matches, the password is correct; you never store the actual password.
Common algorithms: MD5 (legacy, avoid for security), SHA-1 (deprecated for new work), SHA-256 and SHA-512 (good choices). For passwords, use a slow, salted hash like bcrypt or Argon2, not raw SHA-256. For file checksums or integrity, SHA-256 is fine.
Online hash generators are handy for checksums (e.g. "is this file unchanged?") or learning how hashing looks. Paste text or upload a file and get the hash. Do not put real passwords into unknown sites; use a local or trusted tool for that.
A small change in input produces a completely different hash. That is the "avalanche" effect. It makes hashes good for detecting tampering: if one bit of a file changes, the hash changes. So hashes are used to verify downloads and detect corruption.
Hashes are deterministic: the same input always produces the same output. That is what allows comparison. It also means that common inputs (e.g. "password123") have the same hash everywhere, which is why we add a unique salt when hashing passwords—so the same password does not produce the same hash on every site.
Encryption is reversible: you encrypt with a key and decrypt with the same (or a matching) key. So you can hide data and get it back later. Use encryption when you need to store or send data and read it again: encrypted backups, secure messages, or protecting fields in a database.
Symmetric encryption uses one key for both encrypt and decrypt (e.g. AES). Asymmetric encryption uses a key pair: a public key to encrypt and a private key to decrypt (e.g. RSA). Both are "encryption" in the sense that the process is reversible with the right key.
Do not confuse hashing with encryption. If you "hash" something and expect to get the original back, you need encryption instead. If you only need to check "is this the same as before?" or "does this password match?", hashing is the right tool.
In short: hashing = fingerprint, one-way. Encryption = lockbox, two-way with a key. Use hashes for passwords and integrity; use encryption for data you need to recover.
Encryption without authentication can be tampered with: an attacker might change the ciphertext so that decryption produces different (but still valid-looking) data. Modern practice is to use authenticated encryption (e.g. AES-GCM) so that any tampering is detected when you decrypt.
Passwords: hash them (with a salt, and use bcrypt/Argon2 for storage). You never need to "decrypt" a password; you only need to check a match. Hashing is the right choice.
File integrity: hash the file (e.g. SHA-256) and compare hashes before and after download or backup. If the hash matches, the file is unchanged. No key is involved.
Sensitive data you must read again (e.g. credit card tokens, personal data at rest): encrypt it. You need a key and a proper encryption scheme. Hashing would destroy the data permanently.
API secrets or tokens: store them encrypted if you need to use them again (e.g. to call an API). Hash them only if you are comparing (e.g. "does this token match the one we stored?"). Usually for API keys you store encrypted or in a secret manager, not hashed.
Digital signatures use asymmetric crypto: you sign with a private key and others verify with your public key. That is not encryption in the "hide content" sense, but it uses the same mathematical ideas. Signing proves authenticity and integrity; hashing is often part of the signing process.
For learning or one-off checksums, an online hash generator that runs in the browser is fine. You can hash a file or string and compare with a known value. Avoid pasting real passwords or secrets into any site you do not trust; use a local tool or a generator that states it does not send data to a server.
When you need to encrypt or decrypt, use established libraries or tools. Do not roll your own crypto. Correct encryption requires the right algorithm, mode, key management, and often authentication (e.g. AEAD). Online "encrypt this" tools are for testing or non-sensitive data; for real secrets, use a proper app or library.
If a tool says "hash" but offers "decrypt," it is not really hashing—it is encryption or encoding (e.g. Base64). True hashes cannot be reversed. Knowing the difference helps you pick the right tool and avoid security mistakes.
Base64 is encoding, not encryption. It turns binary data into text so it can be sent or stored safely in text-based systems. Anyone can decode Base64; there is no key. Do not use Base64 to "hide" sensitive data. Use real encryption if secrecy is required.
When storing hashes (e.g. in a database), use a dedicated column and index if you need to look up by hash. For passwords, never store the plain password; store only the salted hash. If you need to support "forgot password," use a secure reset flow (e.g. time-limited token), not "email me my password"—you should not have the password to send.
A salt is random data added to input before hashing (e.g. before hashing a password). It ensures the same password does not produce the same hash everywhere and defeats precomputed tables (rainbow tables). Each password should have its own random salt, stored alongside the hash.
Encryption keys must be kept secret and strong. Generate them with a proper random source (e.g. crypto library), not a guessable value. Key length matters: AES-256 is standard; 128-bit can be acceptable depending on use case. Do not hardcode keys in source code; use environment variables or a secret manager.
Key rotation is the practice of changing keys periodically or after a compromise. For encryption, you need a strategy to re-encrypt data when you rotate. For hashes (e.g. passwords), you cannot "rotate" the hash without the user’s password; you can only upgrade to a stronger hash algorithm when the user next logs in.
If you lose an encryption key, the data is gone. Back up keys securely (e.g. in a hardware security module or encrypted backup) and document who can access them. For hashes, there is no key to lose—but you must not lose the salt or you cannot verify passwords correctly.
Read more articles on the FlexKit blog