国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 php手冊 今天和大家探討一個很重要的問題密碼安全

今天和大家探討一個很重要的問題密碼安全

Jun 21, 2016 am 09:14 AM
length quot srand

安全|問題

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)."\n");
for ($m=0; $m $crack = $sRand[$q].$sRand[$m];
fputs($fp, $crack."|".md5($crack)."\n");
for ($l=0; $l $crack = $sRand[$q].$sRand[$m].$sRand[$l];
fputs($fp, $crack."|".md5($crack)."\n");
for ($o=0; $o $crack = $sRand[$q].$sRand[$m].$sRand[$l].$sRand[$o];
fputs($fp, $crack."|".md5($crack)."\n");
}
}
}
fclose($fp);
}

--------------------------------------------------------------------------------


需要注意地是,這只是一個例子,為了簡單期間,我們鎖定密碼字元為26個小寫字母,26個大寫字母,10個數(shù)字(相信應該適合大多數(shù)密碼了,不知哪位BT朋友加標點符號呢?呵呵……),而我們只測試四位以內(nèi)地密碼,密碼位數(shù)增多時原理相同,只是破解可能性大大降低,這個一會兒再講。

這樣,就再dic目錄下產(chǎn)生了一系列字典文件。
現(xiàn)在,讓我們來做一個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) {
echo "破解密碼為:".$adics[0]."
";
$mtime = explode(' ', microtime());
$endtime = $mtime[1] + $mtime[0];
echo "總耗時:".round($endtime - $starttime, 6)."秒

";
echo "繼續(xù)測試";
exit();
}
}

for ($s=0; $s if ($s >25 && $s $op = 'cap';
} else {
$op = '';
}
$afcontent = file("./dic/".$op.$sRand[$s].".txt", "r");
foreach($afcontent as $sdics) {
if (md5($sdics) == $md5_pwd) {
echo "破解密碼為:".$sdics;
exit();
}
}
}

--------------------------------------------------------------------------------


在程序中,你再加上檢測運行時間的代碼,就可以知道破解一個62字元四位長度的MD5密碼需要多長時間了。。。
沒測之前,大家先估計一下呢?


還有,現(xiàn)在默認要產(chǎn)生大概537M~~
且需花費15分鐘左右生成字典(在我PIII733 256M 內(nèi)存上)





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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Use java's String.length() function to get the length of a string Use java's String.length() function to get the length of a string Jul 25, 2023 am 09:09 AM

Use Java's String.length() function to get the length of a string. In Java programming, string is a very common data type. We often need to get the length of a string, that is, the number of characters in the string. In Java, we can use the length() function of the String class to get the length of a string. Here is a simple example code: publicclassStringLengthExample{publ

php提交表單通過后,彈出的對話框怎樣在當前頁彈出,該如何解決 php提交表單通過后,彈出的對話框怎樣在當前頁彈出,該如何解決 Jun 13, 2016 am 10:23 AM

php提交表單通過后,彈出的對話框怎樣在當前頁彈出php提交表單通過后,彈出的對話框怎樣在當前頁彈出而不是在空白頁彈出?想實現(xiàn)這樣的效果:而不是空白頁彈出:------解決方案--------------------如果你的驗證用PHP在后端,那么就用Ajax;僅供參考:HTML code

Introduction to the usage of length function Introduction to the usage of length function Sep 19, 2023 am 11:41 AM

The length function is used to return the number of characters or bytes in a specified string. It can be used to calculate the length of a string for operation and judgment when querying and processing string data. It should be noted that the length function counts the number of characters in the string, not the number of bytes. For multibyte character sets, a character may consist of multiple bytes. Therefore, the length function counts multibyte characters as one character when calculating the string length.

In C/C++, rand() and srand() are translated as follows: In C/C++, rand() and srand() are translated as follows: Sep 05, 2023 pm 03:25 PM

In this article, we will discuss the working principle, syntax and examples of rand() and srand() functions in C++STL. What is rand()? The rand() function is a built-in function in C++STL and is defined in the header file. rand() is used to generate a series of random numbers. We can use this function when we want to generate random numbers in code. Just like when we make ludo game in C++, we have to generate any random number between 1 and 6, so we can use rand() to generate the random number. Random numbers are generated using an algorithm that gives a sequence of uncorrelated numbers whenever this function is called. Just like we want to generate a random number between 1-6, we can use

圖片消失怎么解決 圖片消失怎么解決 Apr 07, 2024 pm 03:02 PM

圖片消失如何解決先是圖片文件上傳$file=$_FILES['userfile']; ?if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'

不用數(shù)據(jù)庫來實現(xiàn)用戶的簡單的下載,代碼如下,但是卻不能下載,請高手找下原因,文件路勁什么的沒有關問題 不用數(shù)據(jù)庫來實現(xiàn)用戶的簡單的下載,代碼如下,但是卻不能下載,請高手找下原因,文件路勁什么的沒有關問題 Jun 13, 2016 am 10:15 AM

不用數(shù)據(jù)庫來實現(xiàn)用戶的簡單的下載,代碼如下,但是卻不能下載,請高手找下原因,文件路勁什么的沒問題。

圖片消失怎么解決 圖片消失怎么解決 Jun 13, 2016 am 10:09 AM

圖片消失如何解決先是圖片文件上傳$file=$_FILES['userfile']; ?if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'

為什么小弟我在php上寫的這個代碼,在瀏覽器上什么都不顯示 為什么小弟我在php上寫的這個代碼,在瀏覽器上什么都不顯示 Jun 13, 2016 am 10:24 AM

為什么我在php上寫的這個代碼,在瀏覽器上什么都不顯示啊

See all articles