Categories > Coding > C++ >

extremely simple password generator in c++

TERIHAX

i say im gay as a joke 🙀

Posts: 2239

Threads: 102

Joined: Jul, 2020

Reputation: 32

Posted

ive been doing random stuff and uh i decided to remake my old shi‍‍tty 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

  • 0

Posts: 531

Threads: 20

Joined: Nov, 2022

Reputation: 44

Replied

@fordlostfocus, stop losing that focus and start FORMATTING PROPERLY BROTHER IN CHRIST :sob: WHAT IS THATT

Comments

TERIHAX 32 Reputation

Commented

too many spaces 😩

  • 1

  • 1

https://cdn.discordapp.com/attachments/1136067487847415848/1146449877660872785/image.png

https://cdn.discordapp.com/attachments/1098921594249814066/1112144294007029932/WRDBanner_Alawapr_1.png

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )