Cracking an MD5 hash

Since MD5 is a method of encryption and is publicly available, it is possible to create a hash collision by using common methods of cracking hashes. This in turn "cracks" the hash and returns to you the value of the string before it had been put through the MD5 process. This is achieved most commonly by a "dictionary" attack. This consists of running a list of words through the MD5 encoding process and checking whether any of them are a match against the MD5 hash you are trying to crack. This works because MD5 hashes are always the same if the same word is hashed.

Getting ready

For this script, we will only need the hashlib module.

How to do it…

To start cracking the MD5 hashes, we need to load a file containing a list of words ...

Get Python Web Penetration Testing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.