上传文件至 ''

This commit is contained in:
2022-06-16 11:42:55 +08:00
parent 83a62b1b5c
commit ad2d69edca

View File

@@ -5,7 +5,7 @@
#include <sys/time.h>
#include <string.h>
#define BUFFER_SIZ 270
#define BUFFER_SIZ 8192
char pool[] = {
@@ -18,17 +18,10 @@ char pool[] = {
'Y', 'Z', '!', '@', '#', '$', '%', '^', '&', '*',
'[', ']', '\\', '|', ';', '\'', ',', '.', '/', '{', '}', ':', '"', '<', '>', '?'
}; //随机池
};
int main(int argc, char *argv[])
{
// srand(time(0));
/*
使用 time(0) 做种子,在一秒之内种子是不会变的
通过使用微妙,来增加随机数的随机性
*/
int PASSWD_LEN = 16;
struct timeval tpstart;
char password[BUFFER_SIZ];
@@ -39,11 +32,17 @@ int main(int argc, char *argv[])
{
PASSWD_LEN = atoi(argv[1]);
}
if (PASSWD_LEN >= BUFFER_SIZ)
{
printf("Password too long!\n");
exit(1);
}
memset(password, 0, BUFFER_SIZ);
gettimeofday(&tpstart, NULL);
srand(tpstart.tv_usec);
while (i != PASSWD_LEN) {
password[i++] = pool[rand() % sizeof(pool)];
}