How do one-way hash functions work? (Edited)

前端 未结 7 2173
予麋鹿
予麋鹿 2020-11-30 22:21

I read the Wikipedia article about md5 hashes but I still can\'t understand how a hash can\'t be \"reconstituted\" back to the original text.

Could someone explain t

7条回答
  •  旧时难觅i
    2020-11-30 23:13

    Here's a very simple example. Assume that I'm a beginning cryptographer and I create a hash function that does the following:

    int SimpleHash(file) {
        return 0 if file.length is even;
        return 1 if file.length is odd;
    }
    

    Now here's the test. SimpleHash(specialFile) is 0. What was my original file?

    Obviously, there's no way to know (although you could likely discover pretty easily that my hash is based on file length). There is no way to "reconstitute" my file based on the hash because the hash doesn't contain everything that my file did.

提交回复
热议问题