Field notes first, theory second. I see the same confusion repeatedly: people say “encrypted” when they mean “hashed”, or assume public-key crypto is just a stronger version of the ordinary kind. It is not. These are three separate tools. Using the wrong one is a design error, not a small slip.

Hashing: a fingerprint, not a lock

A hash function takes any input and produces a fixed-size output. SHA-256 always gives 256 bits, whether you feed it one word or a 4 GB file. Change a single character of input and the output changes completely. And there is no key and no way back: you cannot “decrypt” a hash.

Hashes answer the question “is this the same data as before?” Software downloads publish a hash so you can check your copy was not corrupted or tampered with. Version control and backup tools use hashes to spot changed files. Passwords are stored as hashes so a stolen database does not hand over the passwords directly (though for that job you need a deliberately slow, salted scheme, not plain SHA-256; I covered that in another article).

My opinion: MD5 and SHA-1 should not be used for anything where an attacker might benefit from forging a match. Researchers have produced collisions for both, meaning two different inputs with the same hash. For file-integrity checks against accidents they still work. Against an adversary, use the SHA-2 or SHA-3 families.

Symmetric encryption: one key, fast

Here the same secret key locks and unlocks the data. AES is the standard choice, usually with 128 or 256-bit keys. It is fast enough to encrypt a whole disk or a video stream without anyone noticing.

The algorithm is rarely the weak point. The problem is the key. If you and a supplier in Pune want to exchange encrypted files, you both need the same key, and you must get it to them without anybody else seeing it. If you could already send a secret safely, you would not need encryption for that message in the first place. This is the key distribution problem, and it is the reason the next tool exists.

Also note that the mode matters. AES used in a careless mode can leak patterns; modern guidance is to use an authenticated mode such as GCM, which detects tampering as well as hiding content. Do not invent your own scheme with the primitives. Use a vetted library.

Asymmetric encryption: a key pair

Asymmetric (public-key) cryptography uses two mathematically linked keys. What one does, the other undoes. You publish the public key to the world and guard the private key.

Two uses follow. First, confidentiality: anyone can encrypt a message with your public key, and only your private key can open it. Second, signatures: you sign with your private key, and anyone can verify with your public key that it came from you and was not altered. Digital signatures on software updates, documents and certificates work this way.

The cost is speed. RSA and elliptic-curve operations are far slower than AES and are not meant for bulk data. Which leads to the pattern that matters most.

How they work together in one web page load

When your browser opens a banking site over HTTPS, three jobs get done by three tools. The server proves its identity with a certificate, which holds its public key and a signature from a certificate authority (asymmetric: signatures). The browser and server then agree on a fresh shared secret using a key-exchange method (asymmetric mathematics again, in modern TLS usually an elliptic-curve Diffie-Hellman exchange). From that shared secret both sides derive a symmetric key, and the rest of the session, all the heavy data, is protected with AES or a similar cipher. Hashes run throughout, inside signatures and message authentication.

So asymmetric crypto solves introduction and identity, symmetric does the bulk work, and hashing provides integrity. Remove any one and the design breaks.

Quick checks for sanity

QuestionRight tool
Has this file changed?Hash
Keep a laptop disk privateSymmetric (AES)
Prove who published an updateDigital signature (asymmetric + hash)
Send a secret to someone you have never metAsymmetric key exchange, then symmetric
Store user passwordsSlow salted password hash

A common error is “encrypting” passwords so the application can email them back. If you can recover a password, so can an attacker who steals the key. Hash them.

Another: believing a longer key fixes everything. Key length is rarely how systems fail. They fail through leaked keys, reused keys, hard-coded keys in source code, expired certificates and bad randomness. Spend your worry there.

One honest caveat: quantum computers, if they reach sufficient scale, would threaten the widely used public-key schemes (RSA, elliptic curves) while only weakening symmetric ones, which is why standards bodies are already publishing post-quantum algorithms. For now, plan to keep your crypto replaceable rather than panic.

Leave a Reply

Trending