Vital password algorithm

xiaoxiao2021-03-06  17

// ******************************************************** ******************* // 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 = 0; j -) // password pointer carry {Array [j] ; if (array [j]! = nDictCount-1) Break; else {array [j] = 0; if (j == 0) bnext = false;}}

NLENGTH ;} file.close ();

转载请注明原文地址:https://www.9cbs.com/read-44948.html

New Post(0)