ДН
Size: a a a
ДН
ДН
FS
FS
V
ДН
V
FS
ДН
V
V
ДН
FS
V
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdarg>
#include <cassert>
using namespace std;
char* pass_generate(char* dest, unsigned len, ...)
{
va_list argptr;
char symbols[1 << (8 * sizeof(char))] = {0};
va_start(argptr, len);
char* part = (char*)va_arg(argptr, char*);
while (part)
{
strcat(symbols, part);
part = (char*)va_arg(argptr, char*);
}
va_end(argptr);
unsigned sl = strlen(symbols);
assert(sl);
for (int idx = 0; idx != len; idx++)
dest[idx] = symbols[rand() % sl];
dest[len] = 0;
return dest;
}
int main()
{
system("chcp 1251 && cls"); // ANSI-CYR
char DEC_DIGITS[] = "0123456789";
char LAT_UPPER[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char LAT_LOWER[] = "abcdefghijklmnopqrstuvwxyz";
char CYR_UPPER[] = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
char CYR_LOWER[] = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
char OTHERS[] = "!@#$%^*()-=+/\\,.;'\x22_?<>[]{}| ";
char pass[96];
cout << "# [ " << pass_generate(pass, 8, DEC_DIGITS, NULL) << " ]\n";
cout << "# [ " << pass_generate(pass, 11, DEC_DIGITS, LAT_LOWER, NULL) << " ]\n";
cout << "# [ " << pass_generate(pass, 16, DEC_DIGITS, LAT_LOWER, OTHERS, NULL) << " ]\n";
cout << "# [ " << pass_generate(pass, 20, DEC_DIGITS, LAT_LOWER, OTHERS, CYR_UPPER, NULL) << " ]\n";
return 0;
}
ДН
ДН
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdarg>
#include <cassert>
using namespace std;
char* pass_generate(char* dest, unsigned len, ...)
{
va_list argptr;
char symbols[1 << (8 * sizeof(char))] = {0};
va_start(argptr, len);
char* part = (char*)va_arg(argptr, char*);
while (part)
{
strcat(symbols, part);
part = (char*)va_arg(argptr, char*);
}
va_end(argptr);
unsigned sl = strlen(symbols);
assert(sl);
for (int idx = 0; idx != len; idx++)
dest[idx] = symbols[rand() % sl];
dest[len] = 0;
return dest;
}
int main()
{
system("chcp 1251 && cls"); // ANSI-CYR
char DEC_DIGITS[] = "0123456789";
char LAT_UPPER[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char LAT_LOWER[] = "abcdefghijklmnopqrstuvwxyz";
char CYR_UPPER[] = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
char CYR_LOWER[] = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
char OTHERS[] = "!@#$%^*()-=+/\\,.;'\x22_?<>[]{}| ";
char pass[96];
cout << "# [ " << pass_generate(pass, 8, DEC_DIGITS, NULL) << " ]\n";
cout << "# [ " << pass_generate(pass, 11, DEC_DIGITS, LAT_LOWER, NULL) << " ]\n";
cout << "# [ " << pass_generate(pass, 16, DEC_DIGITS, LAT_LOWER, OTHERS, NULL) << " ]\n";
cout << "# [ " << pass_generate(pass, 20, DEC_DIGITS, LAT_LOWER, OTHERS, CYR_UPPER, NULL) << " ]\n";
return 0;
}
FS
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdarg>
#include <cassert>
using namespace std;
char* pass_generate(char* dest, unsigned len, ...)
{
va_list argptr;
char symbols[1 << (8 * sizeof(char))] = {0};
va_start(argptr, len);
char* part = (char*)va_arg(argptr, char*);
while (part)
{
strcat(symbols, part);
part = (char*)va_arg(argptr, char*);
}
va_end(argptr);
unsigned sl = strlen(symbols);
assert(sl);
for (int idx = 0; idx != len; idx++)
dest[idx] = symbols[rand() % sl];
dest[len] = 0;
return dest;
}
int main()
{
system("chcp 1251 && cls"); // ANSI-CYR
char DEC_DIGITS[] = "0123456789";
char LAT_UPPER[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char LAT_LOWER[] = "abcdefghijklmnopqrstuvwxyz";
char CYR_UPPER[] = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
char CYR_LOWER[] = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
char OTHERS[] = "!@#$%^*()-=+/\\,.;'\x22_?<>[]{}| ";
char pass[96];
cout << "# [ " << pass_generate(pass, 8, DEC_DIGITS, NULL) << " ]\n";
cout << "# [ " << pass_generate(pass, 11, DEC_DIGITS, LAT_LOWER, NULL) << " ]\n";
cout << "# [ " << pass_generate(pass, 16, DEC_DIGITS, LAT_LOWER, OTHERS, NULL) << " ]\n";
cout << "# [ " << pass_generate(pass, 20, DEC_DIGITS, LAT_LOWER, OTHERS, CYR_UPPER, NULL) << " ]\n";
return 0;
}
V
ДН