Skip to content

Commit 2eaeee1

Browse files
author
benja2998
committed
code: better password generator
1 parent 0b4bd0c commit 2eaeee1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ void option_telegram() {
135135
}
136136

137137
void option_password() {
138+
139+
/* Use a seed */
140+
srand(time(NULL));
141+
138142
std::cout << ansi::GREEN << "Valid choice!" << ansi::RESET << "\n";
139143
std::cout << ansi::CYAN << "Enter password length: " << ansi::RESET;
140144
std::string length;
@@ -155,7 +159,7 @@ void option_password() {
155159
}
156160
std::string password = "";
157161
for (int i = 0; i < length_int; i++) {
158-
const std::string charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()_+-=[]{}|;:,.<>?";
162+
const std::string charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()_+-=[]{}|;:,.<>?~/";
159163
password += charset[rand() % charset.length()];
160164
}
161165
std::cout << ansi::GREEN << "Generated password: " << ansi::RESET << password << "\n";

0 commit comments

Comments
 (0)