// ******************************************************** ******************* // In many cases we need exhaustion algorithms, such as password dictionary. // The key to this algorithm is the issue of password subscript. In //, the write file statement in this example is relatively low, and it is not optimized to reduce algorithm complexity. // If you want to improve the efficiency of your write file, you can use the buffer to write in batches. //***************************************************** BREATH.CNPICK .com ******
Void createpassword () {#define passwordmax 8 // The maximum length of the password will be generated
Char a [] = "0123456789abcdefghijklmnopqrstuvwxyz"; // Possible character Long ndictcount = sizeof (a); // Get password dictionary length char CPASS [passwordmax 2]; // will generate the password long nminl = 1, nmaxl = 3 ; // This example is the password length from 1-3long array [passwordmax]; // password dictionary
Assert (nminl <= nmaxl && nmaxl <= passwordmax); // fault tolerant guarantees long NLENGTH = NMINL; Register Long J, I = 0; BOOL BNEXT; CSTDIOFILE FILE; File.Open ("C: //Dict.txt", CFILE :: MODEWRITE | CFILE :: ModeWrite; While (NLENGTH <= nmaxl) {for (i = 0; i
NLENGTH ;} file.close ();