Home > Backend Development > PHP Tutorial > Today I will discuss a very important question with you_PHP Tutorial

Today I will discuss a very important question with you_PHP Tutorial

WBOY
Release: 2016-07-13 17:12:14
Original
790 people have browsed it

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

for ($q=0; $q<$length; $q++) {
if ($q > 25 && $q < 52) {
$op = 'cap';
} else {
$op = ';
}
$fp = fopen("./dic/".$op.$sRand[$q].".txt", "w");
$crack = $sRand[$q];
fputs($fp, $crack."|".md5($crack)." ");
for ($m=0; $m<$length; $m++) {
$crack = $sRand[$q].$sRand[$m];
fputs($fp, $crack."|".md5($crack)." ");
for ($l=0; $l<$length; $l++) {
$crack = $sRand[$q].$sRand[$m].$sRand[$l];
fputs($fp, $crack."|".md5($crack)." ");
for ($o=0; $o<$length; $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) {

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/629499.htmlTechArticlePHP代码:-------------------------------------------------------------------------------- $sRand = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $length = strle...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template