![]() |
|
[Python] Cracking SHA-256 Hashes with Python (Hashlib and IterTools) - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Cracking SHA-256 Hashes with Python (Hashlib and IterTools) (/showthread.php?tid=4580463) |
Cracking SHA-256 Hashes with Python (Hashlib and IterTools) - Powa. - Dec 11, 2014 This tutorial is mainly meant to show you the basic of using the Hashlib module, but in a rather fun (although, almost useless) way. We'll start by importing our modules and asking the user for the hash they are looking to crack. Code #!/usr/bin/env pythonThen we'll add in an alphabet for bruteforcing. Code #!/usr/bin/env pythonThen create our function for creating a SHA-256 Hash. Code #!/usr/bin/env pythonhashlib.sha256(letter) returns a hash object, and hash_object.hexdigest() returns the HEX of the object (i.e, the hash you'd usually see). Now we're going to make a for loop to hash each letter of the alphabet until we find the correct hash using itertools. Code #!/usr/bin/env pythonAnd then tell the user what the hash was once we found it. Code #!/usr/bin/env pythonAnd there we go, we have a SHA-256 bruteforcer. If you want to test this, I'd suggest only testing 3 letter hashes as 4 letters will take 10 minutes+ and I gave up on 5 letters. This isn't supposed to be an actual cracker, only an introduction to hashlib and itertools. Now you've learnt something.. You should go congratulate yourself. Go watch some porn :). * - nbc_ - Dec 11, 2014 Good introduction, will definitely help people learn. 🎉 |