I have a hash that I know is MD5(MD5(SHA1(SHA1(MD5($pass))))), which I want to decrypt. However I have yet to find any tools which can decrypt this.

Right now my best idea is to write a python script which check the MD5 hash of all possible MD5 hashes against MD5(MD5(SHA1(SHA1(MD5(\$pass))))) to find MD5(SHA1(SHA1(MD5($pass)))), and repeat, peeling away the layers. I feel like this will take a long time though, is there a better way?

  • 1
    $\begingroup$ Just compose them and write one function def _hash(password): MD5(MD5(SHA1(SHA1(MD5(password))))); then, run the entries from your password dictionary through this composed function; When the composed function outputs your target hash, you found the password. $\endgroup$ – Ella Rose Jul 7 '17 at 18:46
  • $\begingroup$ Where are such hashes used ? I ve never seen anything like this $\endgroup$ – Richard R. Matthews Jul 8 '17 at 15:00

Right now my best idea is to write a python script which check the MD5 hash of all possible MD5 hashes

I feel like this will take a long time though

Your feeling is right. In fact, it is very possible that the universe would die before you finished.

Today most password hashes are broken by doing dictionary attacks and throwing in common substitutions. In other words, we exploit the fact that humans are in the loop and are the weakest link. So your best bet, since you know the algorithm, is to write a program that takes a dictionary file as input, runs it through the algorithm, then compare with a target hash. After going all the way through the dictionary you could concatenate words together, try common substitutions, etc. Take a look at what a password cracker like John does (or even see if you can write a custom module for John that implements your algorithm).

  • 3
    $\begingroup$ The other notable hash-cracker would be hashcat. $\endgroup$ – SEJPM Jul 7 '17 at 18:51

What you have is a hash, not an encryption as such you can not decrypt it. What you are looking for is a pre image. A value which would produce the desired results. It is a near certainty there are infinitely many values which result in your desired hash however finding even one of them may be exteemely difficult without knowing something about the original value you are looking for. If you know something about the value like it is a short alpha numrric password or a dictionary word etc. You can enumerate all possible values for the input and calculate the full hash (all layers). You do not need to peel the layers one by one nor would that be even remotely computationally feasible.

If you can't limit significantly the search space for original value I'm afraid you are out of luck it can't be done with computing resources available today or in the foreseeable future.

Writing your own Python script is likely a very inefficient method of conductong a brute force search. Both md5 and sha-1 are efficient hash algorithms with some very fast implementations including some specificly for brute force which work on batches. Obviously you should prefer basing your code on one of those.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy