PHP md5 decoding

md5 decoding

<?
set_time_limit(0);
error_reporting(0);

$fname="";
$hash="";
$word="";
$hash_md5="";

$gen_wlist="";
$fname_wlist="";

for($i=0;$i<10;$i++){
$temp="length".$i;
$$temp="";}

for($i=1;$i<10;$i++){
$temp="length_wlist".$i;
$$temp="";}


$word=@$_POST["word"];

$hash=@$_POST["hash"];
$chars=@$_POST["chars"];
$length=@$_POST["length"];
$fname=@$_GET["fname"];

$gen_wlist=@$_POST["gen_wlist"];
$length_wlist=@$_POST["length_wlist"];
$chars_wlist=@$_POST["chars_wlist"];
$fname_wlist=@$_GET["fname_wlist"];

if(!$hash){$hash=@$_GET["hash"];}
if(!$chars){$chars=@$_GET["chars"];}
if(!$length){$length=@$_GET["length"];}

if(!$gen_wlist){$gen_wlist=@$_GET["gen_wlist"];}
if(!$chars_wlist){$chars_wlist=@$_GET["chars_wlist"];}
if(!$length_wlist){$length_wlist=@$_GET["length_wlist"];}

if(!$chars){$chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";}
if(!$chars_wlist){$chars_wlist="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";}


$length=floor(abs($length));
if($length > 9){$length="0";}
$temp="length".$length;
$$temp="checked";


$length_wlist=floor(abs($length_wlist));
if(($length_wlist > 9) or ($length_wlist == "0")){$length_wlist="1";}
$temp="length_wlist".$length_wlist;
$$temp="checked";

$gen_wlist=floor(abs($gen_wlist));

$action=@$_POST["action"];
if(!$action){$action=@$_GET["action"];}

if(($action == "coding") and ($word)){$hash_md5=md5($word);}
elseif(($action == "decoding") and ((strlen($hash) == "32") or ($gen_wlist == "1"))){preparing();}
elseif(($action == "decode") and (((strlen($hash) == "32") and (file_exists("./order/".$fname.".txt"))) or (($gen_wlist == "1") and (file_exists("./order/".$fname_wlist.".txt"))))){decode();exit;}
else{}


$word=untag($word);
$chars=untag($chars);

Echo "
<title>Êîäèíã md5, Äåêîäèíã md5, Ãåíåðàöèÿ âîðä ëèñòà.</title>
<table align=center>
<tr><td align=center><table>
<tr><td align=center colspan=2><b>Êîäèíã md5, PHP ôóíêöèÿ md5()</b></td></tr>
<tr>
<form action=md5.php method=post>
<input type=hidden name=action value=coding>
<td>Ñëîâî:</td><td><input name=word value=\"".$word."\" style=\"width:255;\"></td></tr>";
if($hash_md5){Echo "<tr><td>Õåø md5:</td><td><tt>".$hash_md5."</tt></td></tr>";}
Echo "
<tr><td align=right colspan=2><input type=submit value=Çàêîäèðîâàòü></td></form></tr>
</table></td></tr>


<tr><td height=25></td></tr>
<tr><td align=center><table>
<tr><td align=center colspan=2><b>Äåêîäèíã md5 ìåòîäîì ïîäáîðêè, áðóò ôîðñ</b></td></tr>";

if($fname){
Echo "
<script>
window.x.close();
</script>
<tr><td align=center colspan=2>Ðåçóëüòàò è ïðîöåññ äåêîäèíãà ñìîòðèòå <a href='./order/".$fname.".txt' target=_blank>çäåñü</a>.</td></tr>
";
}

Echo "
<tr>
<form action=md5.php method=post>
<input type=hidden name=action value=decoding>
<input type=hidden name=gen_wlist value=0>
<td>Õåø md5:</td><td><input name=hash value=\"".$hash."\" maxlength=32 style=\"width:240;\"></td></tr>
<tr><td>Ñèìâîëû:</td><td><input name=chars value=\"".$chars."\" style=\"width:240;\"></td></tr>

<tr><td valign=top>Äëèèíà ñëîâà:</td><td>
1<input type=radio name=length value=1 $length1>&nbsp;&nbsp;
2<input type=radio name=length value=2 $length2>&nbsp;&nbsp;
3<input type=radio name=length value=3 $length3>&nbsp;&nbsp;
4<input type=radio name=length value=4 $length4>&nbsp;&nbsp;
5<input type=radio name=length value=5 $length5>&nbsp;&nbsp;
6<input type=radio name=length value=6 $length6><br>
7<input type=radio name=length value=7 $length7>&nbsp;&nbsp;
8<input type=radio name=length value=8 $length8>&nbsp;&nbsp;
9<input type=radio name=length value=9 $length9>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
íåèçâåñòíî<input type=radio name=length value=0 $length0>
</td></tr>
<tr><td align=right colspan=2><input type=submit value=Äåêîäèðîâàòü></td></form></tr>
</table></td></tr>



<tr><td height=25></td></tr>
<tr><td align=center><table>
<tr><td align=center colspan=2><b>Ãåíåðàöèÿ âîðä ëèñòà, áðóò ôîðñ</b></td></tr>";

if($fname_wlist){
Echo "
<script>
window.x.close();
</script>
<tr><td align=center colspan=2>Ðåçóëüòàò âîðä ëèñòà ñìîòðèòå <a href='./order/".$fname_wlist.".txt' target=_blank>çäåñü</a>.</td></tr>
";
}

Echo "
<tr>
<form action=md5.php method=post>
<input type=hidden name=action value=decoding>
<input type=hidden name=gen_wlist value=1>
<tr><td>Ñèìâîëû:</td><td><input name=chars_wlist value=\"".$chars_wlist."\" style=\"width:240;\"></td></tr>

<tr><td valign=top>Äëèèíà ñëîâà:</td><td>
1<input type=radio name=length_wlist value=1 $length_wlist1>&nbsp;&nbsp;
2<input type=radio name=length_wlist value=2 $length_wlist2>&nbsp;&nbsp;
3<input type=radio name=length_wlist value=3 $length_wlist3>&nbsp;&nbsp;
4<input type=radio name=length_wlist value=4 $length_wlist4>&nbsp;&nbsp;
5<input type=radio name=length_wlist value=5 $length_wlist5>&nbsp;&nbsp;
6<input type=radio name=length_wlist value=6 $length_wlist6><br>
7<input type=radio name=length_wlist value=7 $length_wlist7>&nbsp;&nbsp;
8<input type=radio name=length_wlist value=8 $length_wlist8>&nbsp;&nbsp;
9<input type=radio name=length_wlist value=9 $length_wlist9>
</td></tr>
<tr><td align=right colspan=2><input type=submit value=Ãåíåðàöèÿ></td></form></tr>
</table></td></tr>



<tr><td height=25></td></tr>
<tr><td align=center><table width=70%>
<tr><td align=center><b>Äîêà ïî ïðèìåíåíèþ</b></td></tr>
<tr><td><ul><li>Êîäèíã md5</li>
<br>
Âïèñûâàåòå â ñòðîêó \"Ñëîâî\" ñëîâî èëè òåêñò êîòîðûé íóæíî çàêîäèðîâàòü è íàæàâ íà ñóáìèò ïîëó÷èòå ðåçóëüòàò.
</ul></td></tr>
<tr><td><ul><li>Äåêîäèíã md5</li>
<br>
 ñòðîêó \"Õåø md5\" âïèñûâàåòå õåø êîòîðûé íóæíî äåêîäèðîâàòü.
 ñòðîêó \"Ñèìâîëû\" âïèñûâàåòå òå ñèìâîëû, èç êîòîðûõ ñîñòîèò çàêîäèðîâàííîå ñëîâî. Åñëè çíàåòå, òî óêàçûâàåòå äëèíó äàííîãî ñëîâà. Íàæàâ íà ñóáìèò ïîëó÷èòå ðåçóëüòàò â âèäå ôàéëà.
<br>
Íåáîëüøàÿ ñòàòèñòèêà ïî ñêîðîñòè äåêîäèíãà ìîæåòå ïîñìîòðåòü <a href=md5.txt target=_blank>çäåñü</a>.
</ul></td></tr>
<tr><td><ul><li>Ãåíåðàöèÿ âîðä ëèñòà</li>
<br>
 ñòðîêó \"Ñèìâîëû\" âïèñûâàåòå òå ñèìâîëû, èç êîòîðûõ íóæíî ñîñòàâèòü âîðä ëèñò, óêàçûâàåòå äëèíó ñîñòàâëÿåìûõ ñëîâ. Íàæàâ íà ñóáìèò ïîëó÷èòå ðåçóëüòàò â âèäå ôàéëà.
</ul></td></tr>
</table></td></tr>

<tr><td height=25></td></tr>
<tr><td align=center>Àâòîð è ïðîãðàììèñò Michelle</td></tr>
<tr><td align=center>Email: michelle[dog]freenet[dot]am</td></tr>
<tr><td align=center>URL: <a href=http://www.raskrutka.com.ua/ target=_blank>http://www.raskrutka.com.ua/</a></td></tr>

<tr><td align=center>Ñêðèïò ìîæíî ñêà÷àòü <a href=http://www.raskrutka.com.ua/md5/md5.zip>îòñþäà</a>.</td></tr>
</table>
";


function untag($string){
$string = str_replace("\\\"","&quot;",$string);
$string = str_replace("\\\\","\\",$string);
$string = str_replace("<","&lt;",$string);
$string = str_replace(">","&gt;",$string);
return $string;
}


function preparing(){
global $hash, $chars, $length, $fname, $gen_wlist, $chars_wlist, $length_wlist, $fname_wlist;
$fname_check=0;
$temp="";
while($fname_check == "0"){
$fname="";
for($i=0;$i<8;$i++){
$temp=floor(abs(rand(0,3)));
if($temp == "1"){$fname.=chr(floor(abs(rand(0,25)))+65);}
elseif($temp == "2"){$fname.=chr(floor(abs(rand(0,25)))+97);}
else{$fname.=chr(floor(abs(rand(0,9)))+48);}
}

if(!file_exists("./order/".$fname.".txt")){$fname_check="1";}
}

$file=fopen("./order/".$fname.".txt","w");
fwrite($file,"Ôàéë ñîçäàí: ".date("Y-m-d H:i:s")."\n");
fclose($file);

if($gen_wlist == "1"){$chars_replace=$chars_wlist;}
else{$chars_replace=$chars;}

$chars_replace = str_replace("&","%26",$chars_replace);
$chars_replace = str_replace(" ","%20",$chars_replace);

if($gen_wlist == "1"){
Echo "
<script>
var x;
x=window.open('md5.php?action=decode&gen_wlist=1&chars_wlist=$chars_replace&length_wlist=$length_wlist&fname_wlist=$fname','','width=1, height=1, toolbars=0');
</script>
";
$fname_wlist=$fname;
$fname="";
}
else{
Echo "
<script>
var x;
x=window.open('md5.php?action=decode&gen_list=0&hash=$hash&chars=$chars_replace&length=$length&fname=$fname','','width=1, height=1, toolbars=0');
</script>
";
}

}


function decode(){
global $hash, $chars, $length, $fname, $gen_wlist, $chars_wlist, $length_wlist, $fname_wlist, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){
$decode_chars=$chars_wlist;
$fname=$fname_wlist;
$length_min=$length_wlist;$length_max=$length_wlist;}
else{
$decode_chars=$chars;
if($length == "0"){$length_min="1";$length_max="9";}
else{$length_min=$length;$length_max=$length;}}

$decode_chars_length=strlen($decode_chars);

for($i=$length_min;$i<=$length_max;$i++){
$count="0";
$file=fopen("./order/".$fname.".txt","a");
if($gen_wlist == "1"){
fwrite($file,"Íà÷àëî ãåíåðàöèè ïî äëèíå ".$i.": ".date("Y-m-d H:i:s")."\n");}
else{
fwrite($file,"Íà÷àëî äåêîäèíãà ïî äëèíå ".$i.": ".date("Y-m-d H:i:s")."\n");}
fclose($file);

$r="decode$i";
$decode=$r($hash);

if($decode == ""){$process="îòðèöàòåëüíûé.";}
else{$process="ïîëîæèòåëüíûé.\nÈñêîìîå ñëîâî: ".$decode;}

$file=fopen("./order/".$fname.".txt","a");
if($gen_wlist == "1"){
fwrite($file,"Êîíåö ãåíåðàöèè ïî äëèíå ".$i.": ".date("Y-m-d H:i:s").", âñåãî ".$count." êîìáèíàöèé\n");}
else{
fwrite($file,"Êîíåö äåêîäèíãà ïî äëèíå ".$i.": ".date("Y-m-d H:i:s").", ïðîâåðåííî ".$count." êîìáèíàöèé, ðåçóëüòàò ".$process."\n");}
fclose($file);

if($decode != ""){break;}
}
}


function decode1($hash){
global $gen_wlist, $fname, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){$file=fopen("./order/".$fname.".txt","a");}

$decoded="";
$string="";
for($j=0;$j<$decode_chars_length;$j++){
$count++;
$string=$decode_chars[$j];

if($gen_wlist == "1"){
fwrite($file,$string."\n");}
else{
if(md5($string) == $hash){$decoded=$string;break;}}}

if($gen_wlist == "1"){fclose($file);}

return $decoded;
}


function decode2($hash){
global $gen_wlist, $fname, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){$file=fopen("./order/".$fname.".txt","a");}

$decoded="";
$string="";
for($i=0;$i<$decode_chars_length;$i++){
for($j=0;$j<$decode_chars_length;$j++){
$count++;
$string=$decode_chars[$i]."".$decode_chars[$j];
if($gen_wlist == "1"){
fwrite($file,$string."\n");}
else{
if(md5($string) == $hash){$decoded=$string;break;}}}}

if($gen_wlist == "1"){fclose($file);}

return $decoded;
}


function decode3($hash){
global $gen_wlist, $fname, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){$file=fopen("./order/".$fname.".txt","a");}

$decoded="";
$string="";
for($i=0;$i<$decode_chars_length;$i++){
for($j=0;$j<$decode_chars_length;$j++){
for($k=0;$k<$decode_chars_length;$k++){
$count++;
$string=$decode_chars[$i]."".$decode_chars[$j]."".$decode_chars[$k];
if($gen_wlist == "1"){
fwrite($file,$string."\n");}
else{
if(md5($string) == $hash){$decoded=$string;break;}}}}}

if($gen_wlist == "1"){fclose($file);}

return $decoded;
}


function decode4($hash){
global $gen_wlist, $fname, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){$file=fopen("./order/".$fname.".txt","a");}

$decoded="";
$string="";
for($i=0;$i<$decode_chars_length;$i++){
for($j=0;$j<$decode_chars_length;$j++){
for($k=0;$k<$decode_chars_length;$k++){
for($n=0;$n<$decode_chars_length;$n++){
$count++;
$string=$decode_chars[$i]."".$decode_chars[$j]."".$decode_chars[$k]."".$decode_chars[$n];
if($gen_wlist == "1"){
fwrite($file,$string."\n");}
else{
if(md5($string) == $hash){$decoded=$string;break;}}}}}}

if($gen_wlist == "1"){fclose($file);}

return $decoded;
}


function decode5($hash){
global $gen_wlist, $fname, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){$file=fopen("./order/".$fname.".txt","a");}

$decoded="";
$string="";
for($i=0;$i<$decode_chars_length;$i++){
for($j=0;$j<$decode_chars_length;$j++){
for($k=0;$k<$decode_chars_length;$k++){
for($n=0;$n<$decode_chars_length;$n++){
for($m=0;$m<$decode_chars_length;$m++){
$count++;
$string=$decode_chars[$i]."".$decode_chars[$j]."".$decode_chars[$k]."".$decode_chars[$n]."".$decode_chars[$m];
if($gen_wlist == "1"){
fwrite($file,$string."\n");}
else{
if(md5($string) == $hash){$decoded=$string;break;}}}}}}}

if($gen_wlist == "1"){fclose($file);}

return $decoded;
}


function decode6($hash){
global $gen_wlist, $fname, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){$file=fopen("./order/".$fname.".txt","a");}

$decoded="";
$string="";
for($i=0;$i<$decode_chars_length;$i++){
for($j=0;$j<$decode_chars_length;$j++){
for($k=0;$k<$decode_chars_length;$k++){
for($n=0;$n<$decode_chars_length;$n++){
for($m=0;$m<$decode_chars_length;$m++){
for($o=0;$o<$decode_chars_length;$o++){
$count++;
$string=$decode_chars[$i]."".$decode_chars[$j]."".$decode_chars[$k]."".$decode_chars[$n]."".$decode_chars[$m]."".$decode_chars[$o];
if($gen_wlist == "1"){
fwrite($file,$string."\n");}
else{
if(md5($string) == $hash){$decoded=$string;break;}}}}}}}}

if($gen_wlist == "1"){fclose($file);}

return $decoded;
}


function decode7($hash){
global $gen_wlist, $fname, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){$file=fopen("./order/".$fname.".txt","a");}

$decoded="";
$string="";
for($i=0;$i<$decode_chars_length;$i++){
for($j=0;$j<$decode_chars_length;$j++){
for($k=0;$k<$decode_chars_length;$k++){
for($n=0;$n<$decode_chars_length;$n++){
for($m=0;$m<$decode_chars_length;$m++){
for($o=0;$o<$decode_chars_length;$o++){
for($p=0;$p<$decode_chars_length;$p++){
$count++;
$string=$decode_chars[$i]."".$decode_chars[$j]."".$decode_chars[$k]."".$decode_chars[$n]."".$decode_chars[$m]."".$decode_chars[$o]."".$decode_chars[$p];
if($gen_wlist == "1"){
fwrite($file,$string."\n");}
else{
if(md5($string) == $hash){$decoded=$string;break;}}}}}}}}}

if($gen_wlist == "1"){fclose($file);}

return $decoded;
}


function decode8($hash){
global $gen_wlist, $fname, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){$file=fopen("./order/".$fname.".txt","a");}

$decoded="";
$string="";
for($i=0;$i<$decode_chars_length;$i++){
for($j=0;$j<$decode_chars_length;$j++){
for($k=0;$k<$decode_chars_length;$k++){
for($n=0;$n<$decode_chars_length;$n++){
for($m=0;$m<$decode_chars_length;$m++){
for($o=0;$o<$decode_chars_length;$o++){
for($p=0;$p<$decode_chars_length;$p++){
for($q=0;$q<$decode_chars_length;$q++){
$count++;
$string=$decode_chars[$i]."".$decode_chars[$j]."".$decode_chars[$k]."".$decode_chars[$n]."".$decode_chars[$m]."".$decode_chars[$o]."".$decode_chars[$p]."".$decode_chars[$q];
if($gen_wlist == "1"){
fwrite($file,$string."\n");}
else{
if(md5($string) == $hash){$decoded=$string;break;}}}}}}}}}}

if($gen_wlist == "1"){fclose($file);}

return $decoded;
}


function decode9($hash){
global $gen_wlist, $fname, $decode_chars, $decode_chars_length, $count;

if($gen_wlist == "1"){$file=fopen("./order/".$fname.".txt","a");}

$decoded="";
$string="";
for($i=0;$i<$decode_chars_length;$i++){
for($j=0;$j<$decode_chars_length;$j++){
for($k=0;$k<$decode_chars_length;$k++){
for($n=0;$n<$decode_chars_length;$n++){
for($m=0;$m<$decode_chars_length;$m++){
for($o=0;$o<$decode_chars_length;$o++){
for($p=0;$p<$decode_chars_length;$p++){
for($q=0;$q<$decode_chars_length;$q++){
for($r=0;$r<$decode_chars_length;$r++){
$count++;
$string=$decode_chars[$i]."".$decode_chars[$j]."".$decode_chars[$k]."".$decode_chars[$n]."".$decode_chars[$m]."".$decode_chars[$o]."".$decode_chars[$p]."".$decode_chars[$q]."".$decode_chars[$r];
if($gen_wlist == "1"){
fwrite($file,$string."\n");}
else{
if(md5($string) == $hash){$decoded=$string;break;}}}}}}}}}}}

if($gen_wlist == "1"){fclose($file);}

return $decoded;
}
?>