How is an MD5 or SHA-X hash different from an encryption?

♀尐吖头ヾ 提交于 2019-12-12 02:39:50

问题


I've read a couple times that MD5 is not an encryption, e.g. on MD5 ... Encryption? or Command Line Message 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?


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/7574023/how-is-an-md5-or-sha-x-hash-different-from-an-encryption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!