Friday, October 13, 2023
HomeSoftware EngineeringTips on how to Create a Password Generator in C++

Tips on how to Create a Password Generator in C++


You possibly can simply create a password generator in C++ with the next easy methodology.

Tips on how to create the Password Generator in C++

#embody <iostream>
#embody <string>
#embody <algorithm>
#embody <random>

std::string generate_password(int size = 16) {
    std::string seed = string("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + string("0123456789") + string("[email protected]#$%^&*()_+=-{}[]|:;<>,.?/");

    std::string password_string = seed;
    std::shuffle(password_string.start(), password_string.finish(), std::mt19937{std::random_device{}()});
    return password_string.substr(0, size);
}

int foremost() {
    std::cout << generate_password() << std::endl;
    std::cout << generate_password(28) << std::endl;
    return 0;
}



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments