PDA

View Full Version : MD5 Hash creator


Banki
02-23-2009, 04:22 AM
Hey,

I made a little PHP program that creates and saves passwords with their MD5 hashes into a database. You can use that to lookup a certain password MD5 hash, so you know the password. I don't have the SQL file, because I stopped generating after an hour, and I calculated that you need a few years to generate all passwords with their hashes. Passwords are maximum 11 characters long. OW yeah, it takes a few thousand ages to generate all passes :p. Passwords can contain 62 characters; a-z and A-Z and 0-9.

Here is a list of all calculated data I have:

1. Average 450,000 passwords per minute; or average 7777 passwords per second.
2. Above average gives you following data:
2a. 28,000,000 passwords in 1 hour.
2b. 672,000,000 passwords in 1 day.
3. There are totally (62^5 + 62^6 + 62^7 + 62^8 + 62^9 + 62^10 + 62^11) passwords with 5 to 11 characters. That makes a total of 52,889,619,055,688,257,184
4. According (2b) and (3) you know now it takes 78,704,790,261 days to generate all passwords. That means 215,629,562 years to generate all passwords.
5. Above calculations are not 100% accurate. I made some rounding in the first step, so that gives some difference later on. All calculations are for just 1 computer. If you can use some heavy computers, it will take some less time, but still, not worth it.

Anyway, here is the script:

<?php

set_time_limit(0);

$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'md5hash';

mysql_connect($host, $user, $pass);
mysql_select_db($db);

$tekens = array(

1 => "a",
2 => "b",
3 => "c",
4 => "d",
5 => "e",
6 => "f",
7 => "g",
8 => "h",
9 => "i",
10 => "j",
11 => "k",
12 => "l",
13 => "m",
14 => "n",
15 => "o",
16 => "p",
17 => "q",
18 => "r",
19 => "s",
20 => "t",
21 => "u",
22 => "v",
23 => "w",
24 => "x",
25 => "y",
26 => "z",
27 => "A",
28 => "B",
29 => "C",
30 => "D",
31 => "E",
32 => "F",
33 => "G",
34 => "H",
35 => "I",
36 => "J",
37 => "K",
38 => "L",
39 => "M",
40 => "N",
41 => "O",
42 => "P",
43 => "Q",
44 => "R",
45 => "S",
46 => "T",
47 => "U",
48 => "V",
49 => "W",
50 => "X",
51 => "Y",
52 => "Z",
53 => "0",
54 => "1",
55 => "2",
56 => "3",
57 => "4",
58 => "5",
59 => "6",
60 => "7",
61 => "8",
62 => "9"

);

for( $a = 1; $a <= 62; $a++ ) {

for( $b = 1; $b <= 62; $b++ ) {

for( $c = 1; $c <= 62; $c++ ) {

for( $d = 1; $d <= 62; $d++ ) {

for( $e = 1; $e <= 62; $e++ ) {

for( $f = 1; $f <= 62; $f++ ) {

for( $g = 1; $g <= 62; $g++ ) {

for( $h = 1; $h <= 62; $h++ ) {

for( $i = 1; $i <= 62; $i++ ) {

for( $j = 1; $j <= 62; $j++ ) {

for( $k = 1; $k <= 62; $k++ ) {

$inst = $tekens[$a] . $tekens[$b] . $tekens[$c] . $tekens[$d] . $tekens[$e] . $tekens[$f] . $tekens[$g] . $tekens[$h] . $tekens[$i] . $tekens[$j] . $tekens[$k];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}


$inst = $tekens[$a] . $tekens[$b] . $tekens[$c] . $tekens[$d] . $tekens[$e] . $tekens[$f] . $tekens[$g] . $tekens[$h] . $tekens[$i] . $tekens[$j];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}


$inst = $tekens[$a] . $tekens[$b] . $tekens[$c] . $tekens[$d] . $tekens[$e] . $tekens[$f] . $tekens[$g] . $tekens[$h] . $tekens[$i];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}


$inst = $tekens[$a] . $tekens[$b] . $tekens[$c] . $tekens[$d] . $tekens[$e] . $tekens[$f] . $tekens[$g] . $tekens[$h];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}


$inst = $tekens[$a] . $tekens[$b] . $tekens[$c] . $tekens[$d] . $tekens[$e] . $tekens[$f] . $tekens[$g];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}


$inst = $tekens[$a] . $tekens[$b] . $tekens[$c] . $tekens[$d] . $tekens[$e] . $tekens[$f];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}


$inst = $tekens[$a] . $tekens[$b] . $tekens[$c] . $tekens[$d] . $tekens[$e];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}


$inst = $tekens[$a] . $tekens[$b] . $tekens[$c] . $tekens[$d];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}


$inst = $tekens[$a] . $tekens[$b] . $tekens[$c];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}


$inst = $tekens[$b] . $tekens[$b];

mysql_query("INSERT INTO lijst VALUES('', '". $inst ."', '". md5($inst) ."')");

echo "<b>". $inst ."</b><br>";

}

mysql_query("INSERT INTO lijst VALUES('', '". $tekens[$a] ."', '". md5($tekens[$a]) ."')");

echo "<b>". $tekens[$a] ."</b><br>";

}

?>

Maybe I will run the script some hours.

Don't forget, the database requires a lot of space :). And the output file you got (because I put some ECHOs in it) is also kinda big. In 6 minutes, you have a file of about 60mb :).

I believe you need a few terrabytes (if not petabytes) to store all data :p.