How is an MD5 or SHA-X hash different from an encryption?
I've read a couple times that MD5 is not an encryption, e.g. on MD5 ... Encryption? or Command Line Messa开发者_StackOverflow中文版ge Digest Utility.
Well, I get that it's a hash/message digest, and the explanation in the links above says an encryption has to have a key, while hash/md is a cryptographic hash function that produces just a signature. I don't really understand the difference. Couldn't you see the cryptographic hash function / algorithm as a key?
Also, what is the difference between something that's cryptographic and something that's encryption?
You can't "decrypt" a md5 hashed function, and you chose a bad algorithm if you want to transmit information and the receiver can't read it.
So encryption must be decryptable. MD5 is a "cryptographic" hash function, because it's very difficult to produce a block of information that has a specific given hash value. So if you want to sign a message, it is enough to sign the hash. This uses less computing power and the receiver can regardless be sure that the original message is untouched.
A hash algorithm causes information about the original data to be lost irreplaceably, whereas an encryption algorithm has a corresponding decryption algorithm which restores the original data.
This can be shown in that hash algorithm results have a uniform size (128, 160, 256, etc. bits) regardless of the input, whereas encryption algorithm results have a variable size depending on the size of the input.
I don't think you can regard the function itself as a key. Because a key is something you pass to the function in order encrypt or decrypt (<- impossible with md5) a message.
精彩评论