Jump to content

are hashes reversible?

Go to solution Solved by C2dan88,

These websites that claim to decrypt md5 hashes do nothing other than do a lookup

 

How it works is when enter in your phrase the site will md5 hash it, they store that hash in their database (if it is not there already). When you paste that hash into their decryption page all they do is perform a database lookup and return the phrase that matches the hash.

So, first of all im sorry if this is the wrong forum for the question im about to ask(probably is) but i couldnt find any other forum relevant for this so whatever, here I go!

My question is, that when ever I watch a video on hashes or read about them(including the teckquicke video), it is always mentioned that hashes are NOT reversible. But then why can we decrypt a md5 hash by searching it on google or decrypt a sha1 hash using specific websites. Does decrypting not mean reversible? if no then what does 'not being reversible' mean? am i missing something? thanks in advance

Link to comment
Share on other sites

Link to post
Share on other sites

You can't usually reverse them algorithmically, but you can hash alot of things and build dictionaries of possible reversals.This isn't true decryption, it's just a look-up table.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Dredgy said:

You can't reverse them algorithmically, but you can hash alot of things and build dictionaries of possible reversals.

so when i hash a story paragraph and reverse it, the paragraph is already in the dictionary?

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, hammad1029 said:

so when i hash a story paragraph and reverse it, the paragraph is already in the dictionary?

Essentially yes. Do you have an example of something being 'unhashed' that you'd like confirmation on how it works?

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Dredgy said:

Essentially yes. 

no matter how random my para is? that is amazing

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, hammad1029 said:

no matter how random my para is? that is amazing

 

Give examples of something your doing and links to the site. It might be something else. But if your hashing and unhashing on the same site, then when you hash it's added to the dictionary. 

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, hammad1029 said:

so when i hash a story paragraph and reverse it, the paragraph is already in the dictionary?

Not necessarily. It depends on where you generate the hash and where you reverse it. I tried a random sentence in English that made sense still in one MD5 generator and used another site to solve it. It didn't work.

 

It really just depends on how common the string is. And probably once you hash it, it gets added to a rainbow table if you do this online.

Link to comment
Share on other sites

Link to post
Share on other sites

In theory all encryption is reversible, just without look-up possibilities it can take several lifetimes at our current and likely future processing power.

My Build:

Spoiler

CPU: i7 4770k GPU: GTX 780 Direct CUII Motherboard: Asus Maximus VI Hero SSD: 840 EVO 250GB HDD: 2xSeagate 2 TB PSU: EVGA Supernova G2 650W

Link to comment
Share on other sites

Link to post
Share on other sites

These websites that claim to decrypt md5 hashes do nothing other than do a lookup

 

How it works is when enter in your phrase the site will md5 hash it, they store that hash in their database (if it is not there already). When you paste that hash into their decryption page all they do is perform a database lookup and return the phrase that matches the hash.

Link to comment
Share on other sites

Link to post
Share on other sites

The definition of a cryptographic hash is a function that maps an arbitrary input into a fixed length output. Start with the simple function that meets the definition.

 

Consider the "simplest possible hash algorithm": it takes an input and returns a single 8-bit value that is computed as the sum of "1" bits in the input mod 2^8.

 

If you feed in "hello world" as US-ASCII you'll get out the sum of "1" bits in

 

"01001000 01100101 01101100 01101100 01101111 00100000 01110111 01101111 01110010 01101100 01100100 "

 

You'll get "," (US-ASCII 44) or maybe "2C" (the hex-encoding of 44) as output. The exact encoding of the output doesn't particularly matter so long as you know what it is and how to decode it to the value it represents.

 

As the hash function maps any input to a fixed-length output, there is a limit to the possible unique values that it can produce as output. The set of possible inputs is infinitely large, the set of possible output is constrained, so multiple inputs must map to the same output. In mathematics when you have a function that maps multiple inputs to a single output it is called "irreversible".

 

In our "simplest possible hash" there are only 256 unique outputs which means that if you have 257 different messages  you are guaranteed to have two of them hash to the same output. In the case of our simple hash constructing a collision is trivial, just sprinkle 256 "SOH" characters through it.(US-ASCII 1—this character is not printable—lets use the character '@' to stand for 256 SOH characters in a row). We know when summing the "1" bits we're gaurnteed to wrap around exactly once if we add those characters to any input so we can find collisions easily.

 

If we know "@hello world" hashes to the same thing as "hello world" and that we can construct a hash collision by adding any integer multiple of "@" to any given input then we can construct an arbitrary number of collisions: "@hello world" "@@hello world" "@@@hello world" and so forth. We know that there are an infinite number of inputs that hash to any given output and we can make them at will for this simple hashing algorithm/

 

This is true for all hashes which take an arbitrary input and produce a fixed length output. When you use other hashing algorithms—e.g. SHA1—you gain more bits in your fixed length output so you can map more unique inputs before encountering a collision, but it is still a mathematical certainty that there are an infinite number of collisions. A good cryptographic hash maps inputs uniformly and "non-predictably" across the output space which will make construction or detection of collisions more difficult but we know they are there.

 

This same property is how we know that the hash cannot be "reversed": data is lost during the creation of the hash.  If all you know about the input stream is that it used our "simplest possible hashing algorithm" and that the resulting out put was "2C" you have no way to differentiate between the input "@hello world" and "hello world@" or "hello world" because they all hash to the same value.

 

The best you can do is to calculate possible collisions and assume that the first one you find is the correct one. You might choose to assume that is correct because the key-space covered by the output of your hashing algorithm makes collisions unlikely and therefore difficult to find, but you cannot know that with certainty.

 

When people "look up" MD5 hashes—or whatever—all they're doing is finding one possible collision. Typically that's from a list computed ahead of time. but for sufficiently simple hashing algorithms you can construct them "on demand".

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×