开发者

Hashing and dehashing a file

I came across a to开发者_Go百科ol WINMD5FREE which generates an unique hash code to each file. It accepts any file type and gives an output of 33bit hash code. Is there anyway to reverse that process to obtain the file back from that hash code?

Also a fair doubt. While downloading some popular tools there are other links of Md5, SHA, etc besides download links what do these represent?


You seem to have misunderstood what a hash code is. They are made to be irreversible.

You can use them for all sorts of things. Say you wanted to know if you have the same file on two computers but the file is too big to send over the network, simply calculate the hash code for the file on each computer, if you get the same numbers the files are the same, if one single bit differs you will get different hash codes.

Hash codes are also used for password authentication. When you sign up for a website you enter your password. This string is hashed and stored in a database. Since the hashed password is not reversible no one (with some caveats that we won't get into here) can find out your password. When you want to log in you enter your password again, the system hashes the string and compares it to what it has stored in its database. If the hashed strings match the system can be confident (again, with some caveats) that you typed the right password.

Read more on http://en.wikipedia.org/wiki/Hash_code


Hashcodes are usually a one way street. And the intention while designing these hash functions/algorithms is to make it hard to reverse this process.

Usually they are meant to generate a "unique" identifier for a string fast. A string will always translate to the same hash given the same parameters/algorithms. Even if you change only one char it will translate maybe to something different but the result will always be the same.

For recovery purpose ppl generate large tables the so called rainbow tables to reverse this process. You may reverse the hash by e.g. brute-force.

In addition to one comment: Hash algorithms always generate fixed length hashes. Therefore these hash calculation is not bijective. Not being bijective implies that two strings have a chance being mapped to the same hash. So if you brute force something there may be a number of false positives.

As further addition brute-forcing time is somehow dependant on the maximum number of allowed characters in the input. As the commenter said its nearly impossible to reverse the hash of a file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜