Thursday 30 May 2013

Khác biệt giữa Encoding, Encrypting và Hashing


Chúng ta thường hay bị bối rối khi nói về Encoding và Encrypting. Vậy sự khác nhau của chúng là gì? (đọc tiếp thì sẽ biết)
Giống nhau:
 1. Cả 2 đều chuyển đổi dữ liệu sang một định dạng khác.
 2. Cả 2 đều dịch ngược lại được (resersible)
Khác nhau:

Encoding


Mục đích của encoding là chuyển đổi dữ liệu mà nó có thể được sử dụng hoàn toàn (properly and safely) bởi một hệ thống khác. Vai trò của nó không giữ các thông tin bí mật mà đảm bảo chắc chắn rằng dữ liệu có thể được sử dụng hoàn toàn.
Encoding chuyển đổi dữ liệu sang một format khác sử dụng các biểu đồ có sẵn được public trên mạng do đó nó có thể hoàn toàn dịch ngược được. Nó không cần sử dụng bất kì key nào để dịch decode, mà chỉ cần thuật toán encode nó.
Vd:
ASCII, Unicode, URL Encoding, Base64

Encrypting



Mục đích của encryption là chuyển đổi dữ liệu để giữ bí mật, đảm bảo dữ liệu không thể sử dụng bởi bất kì ai ngoài đúng người nhận.
Vd:  AES, Blowfish, RSA

Hashing

Hashing is often confused with encoding and encryption but it's quite different than either. In security, the purpose of hashing is to take arbitrary input and produce a fixed-length string that has the following attributes:

1. The same input will always produce the same output.
2. Multiple disparate inputs should not produce the same output.
3. It should not be possible to go from the output to the input.
4. Any modification of a given input should result in drastic change to the hash.
Hashing is used in conjunction with authentication to produce strong evidence that a given message has not been modified. This is accomplished by taking a given input, hashing it, and then encrypting the sent hash with the recipient's public key.
When the recipient opens the message with their private key they then hash the message themselves and compare it to the hash that was given encrypted by the sender. If they match it is an unmodified message.
Examples: SHA-3, MD5 (Now obsolete), etc.

Summary

Encoding is for maintaining data usability and can be reversed by employing the same algorithm that encoded the content, i.e. no key is used.
Encryption is for maintaining data confidentiality and requires the use of a key (kept secret) in order to return to plaintext.

Hashing is for validating the integrity of content by detecting all modification thereof via obvious changes to the hash output.