Created
July 26, 2024 06:16
-
-
Save AlexeyTolstopyatov/ef1043c8b06404c271098c09676cc50b to your computer and use it in GitHub Desktop.
Маленький генератор паролей на Си.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#define MINC_ASCII 0x21 /* Нижняя граница ASCII таблицы */ | |
#define MAXC_ASCII 0x7a /* Верхняя граница ASCII таблицы */ | |
int main(int argc, char *argv[]) { | |
srand((unsigned int)time(0)); | |
if (argc < 2) { | |
printf("./pwgen [length]\n"); | |
return -1; | |
} | |
for (int t = 0; t < atoi(argv[1]); t++) { | |
printf("%c", rand() % (MAXC_ASCII - MINC_ASCII) + MINC_ASCII); | |
} | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment