Tuesday, 5 April 2016

How to Know the Algorithm Behind a Salted Hashed Password Through the Password and Hash Strings

Leave a Comment

To harden password security, hashing algorithms were introduced. And these have been known to be much more powerful than encryption algorithms as passwords are verified only through known hashes. Sometimes there may be a need to know the algorithm behind a hashed password system, it maybe for learning purpose, out of curiosity or some other purpose. Of course there are malicious users out there that will see it as a starting point to hack a hashed password but this post is not for bad intentions. The case study language here will be PHP (Hypertext Preprocessor). I am going to show you how to use PHP to find a matching algorithm from password hashes.

Problem Scenario
In situations where multiple hashing algorithms is used (for example hashes may look like MD5 but it’s actually md5 of sha1) and algorithm is unknown, algorithm brute force for predicting the backend is needed. In the next section the PHP script that provides a solution to this problem shall be reviewed.

The PHP Script
The PHP script to be used is Algorithm_Buter.php written by fb1h2s. This can be downloaded at Algorithm Bruter to check it out. What the script does is that it takes a known “password” and it’s “hashes” and then traverse it through a list of known hash algorithms in order to find a match and predict the backend algorithm.

How to Use Algorithm_Bruter
When you download and run the script, it displays three fields. The password, hash and salt field. All you actually need to find the algorithm is the first two fields. Simply insert the password and hash strings and then click ok. If a matching algorithm is found then a message is displayed to show the algorithm. For instance if the password entered is olufemi and the algorithm found is md5 of sh1 hashes, the message will be “Algorithm found: Its sha1(md5(olufemi))”.

I have successfully demonstrated how algorithms behind salted hashes can be known by just proving a script with the password and hash string. The script made available can be edited to work better for you if you’re adventurous enough. Anything can be improved upon to be more efficient or work faster. It should be noted that this post is not for malicious users which bad intentions. It is just for educational purpose. I hope something valuable has been added to your intellect after reading this post. I’ll like to thank you for reading and don’t forget to always check back for more post.
If You Enjoyed This, Take 5 Seconds To Share It


Post a Comment

Add a comment here