Brute-forcing...?
Moderator: General Moderators
-
TS_Death_Angel
- Forum Commoner
- Posts: 31
- Joined: Sat Dec 31, 2005 8:49 am
Brute-forcing...?
Hello.
I've been looking for a bit of code that will brute-force an MD5 hash. I try to make my own, and it only makes my head hurt, and I can't find anything on Google, which makes my head hurt even more! ^_^' So I'd appreciate it if someone could give me a small piece of code that will brute force a hash. Cheers.
I've been looking for a bit of code that will brute-force an MD5 hash. I try to make my own, and it only makes my head hurt, and I can't find anything on Google, which makes my head hurt even more! ^_^' So I'd appreciate it if someone could give me a small piece of code that will brute force a hash. Cheers.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
-
TS_Death_Angel
- Forum Commoner
- Posts: 31
- Joined: Sat Dec 31, 2005 8:49 am
-
nickvd
- DevNet Resident
- Posts: 1027
- Joined: Thu Mar 10, 2005 5:27 pm
- Location: Southern Ontario
- Contact:
What are the possible values for the original? a-z, 0-9, special chars, etc...
What is the length of "password" that you are looking to generate?
If you want to generate the hashes for any and all possible values (aaaa, aaab, aaac, aaad, aaae, etc...) Your great, great, great, great, great, great, great grandchildren may still be alive to see the end results...
What is the length of "password" that you are looking to generate?
If you want to generate the hashes for any and all possible values (aaaa, aaab, aaac, aaad, aaae, etc...) Your great, great, great, great, great, great, great grandchildren may still be alive to see the end results...
-
TS_Death_Angel
- Forum Commoner
- Posts: 31
- Joined: Sat Dec 31, 2005 8:49 am
-
TS_Death_Angel
- Forum Commoner
- Posts: 31
- Joined: Sat Dec 31, 2005 8:49 am
Code: Select all
<?php
$charset = 'abcdefghijklmnopqrstuvwxyz'; # alter to suit your ideology
$md5 = '348a448a51d1e0f0f5eee42337d12adc'; #md5 we want to "crack"
echo brute_force_md5($md5, $charset, 4); # crack it
function brute_force_md5($md5, $charset, $max_len)
{
$charset = array_merge(array(null), str_split($charset));
for($i = 0; $i < $max_len; ++$i)
{
@$part1 .= 'for($k'.$i.' = 0, $count = count($charset); $k'.$i.' < $count; ++$k'.$i.') ';
@$part2 .= ($i?'.':'') . '$charset[$k'.$i.']';
}
return eval($part1.'if($md5 === md5($rtn = '.$part2.')) return $rtn; return false;');
}
?>
Last edited by bokehman on Sat Sep 30, 2006 4:57 am, edited 2 times in total.
Such a statement assumes each hash only has one possible source where in fact there are an infinite number of source combinations for each hash hence the term collision, not decrypt.TS_Death_Angel wrote:@nickvd: I am well aware of how long it takes, but it is not my goal to crack one particular hash, but rather make a lookup table for ALL hashes.
-
TS_Death_Angel
- Forum Commoner
- Posts: 31
- Joined: Sat Dec 31, 2005 8:49 am
The idea of having a look up table is ridiculous,. Have you got any idea how many cominabions there are.TS_Death_Angel wrote:Yes, I know there will be collisions, but I will sort out all of these problems (as well as batch writing rather than writing a hash every time it's calculated) once I complete the script.
Thanks for that snippet
Three point four hundred billion billion billion billion. And each of those has an infine number of sources that can create it.
-
TS_Death_Angel
- Forum Commoner
- Posts: 31
- Joined: Sat Dec 31, 2005 8:49 am