What is the difference between encryption and hashing?
sobes.tech AI
Answer from AI
Encryption and hashing are different cryptographic operations with different purposes.
-
Encryption transforms data into a format that can be reversed (decrypted) with a key. It is used to protect data confidentiality during transmission or storage. Example: AES, RSA.
-
Hashing transforms data into a fixed-length hash code that uniquely (as much as possible) corresponds to the original data, but reverse transformation is impossible. It is used for data integrity verification and password storage. Example: SHA-256, bcrypt.
Example: when storing passwords, hashing with a salt is used so that the original password cannot be recovered, and encryption is used during data transmission over a network so that no one can read the content without a key.