使用PHP中破解md5密碼(循環:10萬個/3秒)

使用PHP中破解md5密碼


十萬位 --》2.7086160183 seconds

代碼:


MD5循環<br>
00000到100000(10萬位)<br>
例子:
[url]http://.........php?str=55555[/url]
(限5位數)<br>

<?php
$time_start = getmicrotime();
if (!$str){exit;}
echo $str."的MD5值爲:";
$mdstr = md5($str);
echo  $mdstr."<br>";
echo "開始循環";

function b() {
global $mdstr;
for($i=0;$i<=100000;$i++)
{
$i = str_pad($i, 5, '0', STR_PAD_LEFT);
if (md5($i) === $mdstr) {
   echo "<br>破解結果--->";
   echo $i;
   c();
   exit;
}
}
}
b();
function c() {
global $time_start;
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "<br><br><br>Did nothing in $time seconds<br>";//輸出運行總時間
}
function getmicrotime(){
   list($usec, $sec) = explode(" ",microtime());
   return ((float)$usec + (float)$sec);
   }
?>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章