utkuonursahin / Password-Generator

Password generator CLI for secure passwords.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Password-Generator

A simple password generator that generates a password of a given length with numbers, symbols and letters.

Installation

  1. Clone the repository
  2. Follow our usage guide as below

Usage

We provide two use case scenarios for the password generator.

In the first scenario, just copy the all files from the repository and run the main.cpp file. Application will start running on the terminal and will ask for the length and difficulty of the password to be generated. Then, application will generate a password of the given length and difficulty and will print it on the terminal.

In the second scenario, where you may want to implement our password generator in your code directly, you can do it by following the steps below:

  1. Copy the PasswordGenerator.hpp file from the repository.
  2. Include the file in your project.
  3. Create an object of the class via PasswordGenerator(length,mode) constructor.
  4. Call the generate() function of the class.
  5. Create an empty string and assign the result of getPassword() to it.

API Reference for second scenario usage

PasswordGenerator PG(int length, int difficultyMode)
  • This is the constructor of the class. It takes two arguments, length of the password and difficulty mode.
  • Length of the password is an integer and difficulty mode is an integer.
  • Difficulty mode can be 1, 2 or 3. 1 is for easy, 2 is for medium and 3 is for hard.
  • 1 is number based, 2 is numbers and uppercase and lowercase letters and 3 is numbers, uppercase and lowercase letters and symbols.

void generate()

This function generates the password and stores it in the class variable password. Takes no arguments.


string getPassword()

This function returns the password generated by the generate() function. Takes no arguments.

An example of the second scenario is given below:

#include "PasswordGenerator.hpp"
#include <iostream>
#include <string>
using namespace std;
int main(){
    PasswordGenerator PG(10,1);
    PG.generate();
    string password = PG.getPassword();	
    cout << password << endl;
    return 0;
}

About

Password generator CLI for secure passwords.

License:GNU Affero General Public License v3.0


Languages

Language:C++ 97.3%Language:CMake 2.7%