Encryption vs Hashing

Encryption vs Hashing

·

2 min read

Encryption and hashing are both methods of protecting data, but they are used for different purposes and have some key differences.

Encryption

Encryption is a method of converting plaintext (readable data) into ciphertext (unreadable data) through the use of an algorithm and a key. The process can be reversed, or decrypted, by using the same key. This makes encryption a two-way process.

One example of encryption is the Advanced Encryption Standard (AES), which is a widely-used encryption algorithm. It can be used to encrypt sensitive information, such as credit card numbers or personal information, to protect it from unauthorized access.

Another example is when you use HTTPS protocol which encrypts the data being sent over the internet between the browser and the web server.

Hashing

Hashing, on the other hand, is a one-way process that takes plaintext and converts it into a fixed-length string of characters, known as a hash. The process is not reversible, meaning that the original plaintext cannot be determined from the hash.

One example of a widely-used hashing algorithm is SHA-256. This algorithm is commonly used to secure passwords, as the resulting hash can be stored in a database and compared to the hash of a entered password to verify the user's identity.

Another example is in blockchain system. Each block in the blockchain has a hash that is unique to that block and contains the data and the hash of the previous block. This creates a chain of blocks that cannot be altered without changing the entire chain.

Conclusion

In summary, encryption is a two-way process that is used to protect sensitive information, while hashing is a one-way process that is used for verification and integrity checking. Encryption can be reversed with the use of a key, while hashing cannot be reversed. Encryption is mainly used to protect data in transit, while Hashing is mainly used to protect data at rest.