Home > php教程 > php手册 > 今天和大家探讨一个很重要的问

今天和大家探讨一个很重要的问

WBOY
Release: 2016-06-13 10:13:37
Original
985 people have browsed it

PHP代码:--------------------------------------------------------------------------------
$sRand = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$length = strlen($sRand);
if (!($dir = @opendir("/dic"))) {
mkdir ("dic", 0777);
}

for ($q=0; $q if ($q > 25 && $q $op = 'cap';
} else {
$op = ';
}
$fp = fopen("./dic/".$op.$sRand[$q].".txt", "w");
$crack = $sRand[$q];
fputs($fp, $crack."|".md5($crack)." ");
for ($m=0; $m $crack = $sRand[$q].$sRand[$m];
fputs($fp, $crack."|".md5($crack)." ");
for ($l=0; $l $crack = $sRand[$q].$sRand[$m].$sRand[$l];
fputs($fp, $crack."|".md5($crack)." ");
for ($o=0; $o $crack = $sRand[$q].$sRand[$m].$sRand[$l].$sRand[$o];
fputs($fp, $crack."|".md5($crack)." ");
}
}
}
fclose($fp);
}
--------------------------------------------------------------------------------
需要注意地是,这只是一个例子,为了简单期间,我们锁定密码字元为26个小写字母,26个大写字母,10个数字(相信应该适合大多数密码了,不知哪位BT朋友加标点符号呢?呵呵……),而我们只测试四位以内地密码,密码位数增多时原理相同,只是破解可能性大大降低,这个一会儿再讲。
这样,就再dic目录下产生了一系列字典文件。
现在,让我们来做一个MD5的随机密码:
PHP代码:--------------------------------------------------------------------------------
$afcontent = file("./dic/".$op.$sRand[$s].".txt", "r");
foreach($afcontent as $sdics) {
$adics = explode("|", $sdics);
if (substr($adics[1], 0, 32) == $md5_pwd) {

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template