#include <stdio.h>
#include <string.h>
#include <time.h>
const char lower_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const char upper_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const char number_chars[] = "0123456789";
const char lower_chars[] = "ABCDEFGHIJKMNPQRSTUVWXYZ"; No L or O
const char upper_chars[] = "ABCDEFGHJKLMNPQRSTUVWXYZ"; No I or O
const char number_chars[] = "23456789"; No 1 or 0
const char special_chars[] = "[Email protected]#$%^&* ()-=_+[]{};: ' \" <>,.? /";
const int _ks_pass_len = 17;
void Mkpass (char pass[_ks_pass_len+1])
{
int i = 0, j = 0, k = 0,n = 0;
n = _KS_PASS_LEN/4;
for (; i < n; i++)
{
Pass[i] = Lower_chars[rand ()% (strlen (lower_chars))];
Pass[i+n] = Upper_chars[rand ()% (strlen (upper_chars))];
Pass[i+2*n] = Number_chars[rand ()% (strlen (number_chars))];
Pass[i+3*n] = Special_chars[rand ()% (strlen (special_chars))];
}
j = _ks_pass_len-4*n;
for (i = 0; i<j; i++)
{
Pass[i+4*n] = Special_chars[rand ()% (strlen (special_chars))];
}
Character Disorderly order
for (i = 0; i <; i++)
{
j = rand ()% (_ks_pass_len);
k = Pass[j];
PASS[J] = Pass[i%_ks_pass_len];
Pass[i%_ks_pass_len] = k;
}
Pass[_ks_pass_len] = ' + ';
}
int _tmain (int argc, _tchar* argv[])
{
Srand (Time (0));
Char szpass[_ks_pass_len+1];
for (int i=0; i<16; i++)
{
Mkpass (Szpass);
printf ("%s\n", Szpass);
}
return 0;
}
Password Generator C implementation