Hashing vs Encryption
Hashing and encryption both scramble data, but only encryption can be undone. Encryption uses a key, so someone with the key can read the data again. A hash is a one-way fingerprint. It has no key and no way back. Use encryption for data you need to read later. Use hashing to check files or store passwords.
Encryption
Locking data with a key. Only someone with the key can read it.
Encryption scrambles data with a key, so only someone with the right key can read it. Without the key, the data looks like random noise. Unlike hashing, it can be undone, which is the whole point. Data is encrypted in transit, like HTTPS on the web, and at rest, like a phone's storage. AES and RSA are two of the most used methods.
Hashing (Cryptography)
Turning any data into a short code. It can never be turned back.
Hashing turns any data into a short code of fixed length, called a hash. It cannot be undone. The same input always gives the same hash. Change one letter and the hash changes completely. SHA-256 is a common method, and its hash is 64 characters of hex. Hashes are used to check files were not changed and, with slow methods, to store passwords.
In one line
- Encryption
- Locking data with a key. Only someone with the key can read it.
- Hashing (Cryptography)
- Turning any data into a short code. It can never be turned back.