Categories > Coding > C++ >
extremely simple password generator in c++
Posted
ive been doing random stuff and uh i decided to remake my old shitty password generator that was ported from c (again, much simpler)
this is extremely simple
https://media.discordapp.net/attachments/1108820525230333985/1149059828262645790/image.png
^^ i found this out and thought it was pretty cool
#include <iostream>
#include <string>
#include <cstdlib>
int main()
{
std::srand(time(nullptr));
std::string characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0987654321~`!@#$%^&*()_+[]\\{}|;':\",/.<>?-=";
std::string pass;
int length;
std::cout << "Enter the length of the password:\n";
std::cin >> length;
for (int i = 0; i < length; i++)
{
pass += characters[std::rand() % characters.length()];
}
std::cout << "Generated password:\n" << pass;
return 0;
}
tell me anything i should do better ig
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post