Hashing vs Encrypting
The process of transforming a character string in to a shorter fixed length value (called hash values, hash codes, hash sums or checksums) that represents the original string is called hashing. Usually, a function is used to perform this transformation and it is called a hash function. Hashing would make the indexing and retrieving data in databases faster, since searching the shorter, fixed length hash value would be faster than searching the original value. Encryption is the process of converting data in to a format that cannot be understood by the parties that are unauthorized to see the data. This new format is called the cipher-text. Converting cipher-text back to the original format is called decryption.
What is Hashing?
Converting a character string in to a shorter fixed length value that represents the original string is called hashing. This conversion is performed by a hash function. Hashing allows faster indexing and retrieving of data from databases due to the use of a shorter hash value than the original value. Hashing is also used in encryption algorithms for the encryption and decryption of digital signatures. Hashing is a one way operation and the original value cannot be retrieved by the hash value. Furthermore, hashing should not produce the same hash value for two different original values. Some of the simple and commonly used hashing methods are Division-remainder method, folding method and Radix transformation method.
What is Encrypting?
Converting data in to a format (called cipher-text) that cannot be understood by the parties that are unauthorized to see the data is called encrypting. Encrypting has been used for a long time. Encrypting methods range from simple methods such as substitution of letters for numbers to more complex methods such as rearranging bits in a digital signal using a computer algorithm. Obtaining the original data from the cipher-text is called decryption and it requires the correct decryption key. This key is available only to the parties who are authorized to see the data. An encryption method is called a strong encryption if it cannot be broken without knowing the decryption key. Public key encryption is one of the methods of encryption in which the data is encrypted using the recipient’s public key and it cannot be decrypted without using a matching private key.
What is the difference between Hashing and Encrypting?
Converting a character string in to a shorter fixed length value that represents the original string is called hashing, whereas converting data in to a format (called cipher-text) that cannot be understood by the parties that are unauthorized to see the data, is called encrypting. Since hashing is one way operation in which the original value cannot be retrieved by the hash value, it is also used for encrypting. Message-digest hash functions (MD2, MD4, and MD5) are used to encrypt digital signatures. But use of hashing is not limited to encrypting. Hashing is also used for faster retrieval of data from databases. But the hash functions used for these tasks are different from each other and might not work well if interchanged between the two tasks.