PHP code :--------------------------------------------------------------------------------
$ 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 );
}
--------------------------------------------------------------------------------
It is worth noting that this is just an example. For the sake of simplicity, we lock the Password character into 26 lower-case letters, 26 upper-case letters, and 10 digits (I believe it should be appropriate for most passwords, I don't know which BT friend has punctuation marks? Haha ......), However, we only test the password with four or less digits. The principle is the same when the number of digits increases, but the possibility of cracking is greatly reduced. Let's talk about it later.
In this way, a series of dictionary files are generated under the dic directory.
Now, let's create an MD5 random password:
PHP code :--------------------------------------------------------------------------------
$ Afcontent = file ("./dic/". $ op. $ sRand [$ s]. ". txt", "r ");
Foreach ($ afcontent as $ sdics ){
$ Adics = explode ("|", $ sdics );
If (substr ($ adics [1], 0, 32) ==$ md5_pwd ){