Skip to content

theJ8910/pwgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pwgen

pwgen is a standalone password generator I wrote to make creating strong randomized passwords easy. Requires Python 3.8+.

pwgen is both an executable and a library. You can run it from a terminal or import it and use it as part of another program if you so desire.

Table of Contents

Password Strength

In general, the longer the password and the more characters pwgen has to choose from, the stronger the resulting password will be.

By default, the passwords generated by pwgen are 64 characters long and can contain any uppercase or lowercase letter, number or symbol found on a US keyboard. They can also contain spaces, but spaces will never appear at the beginning or end of the password. Overall, there are 95 distinct characters the password generator can choose from.

A 64 character long password with 95 possible choices for each character would result in 951 + 952 + ... + 9564 = 3.7923332181447157 x 10126 possible combinations. To brute-force a password of this length, a password cracking machine capable of trying 350 billion combinations per second would take 3.7923332181447157 x 10126 / 350 x 109 / 60 / 60 / 24 / 365 = 3.4358313565854136 x 10107 years to finish - several orders of magnitude larger than that of an average human lifetime.

Command Line Usage

After pwgen is installed, running it from the command line is simple and straightforward:

$ python -m pwgen
[the generated password]

By default, pwgen generates a 64-character long password. If you want to generate a password of a different length, you can do so by specifying the length as an argument:

$ python -m pwgen 16

If you want to disable a specific type of character (e.g. special characters like @, #, $, or !), you can specify a command line option to explicitly enable or disable that type of character:

$ python -m pwgen -X

For a full list of options, run pwgen with the "--help" option:

$ python -m pwgen --help

Library Usage

To use pwgen as a library, simply import it and call its generate() function:

import pwgen

pw = pwgen.generate()

As with the command line interface, you can specify to generate() how long you want the passwords to be, and explicitly enable/disable different types of characters as necessary:

import pwgen

pw = pwgen.generate( length=16, specialchars=False )

For full documentation, check the docstrings for generate() by exploring the source code or with the "help" function in the Python interpreter:

>>> import pwgen
>>> help( pwgen.generate )
...

Installation

If you have git installed locally, the following command can be used to install or update pwgen:

pip install git+https://github.com/theJ8910/pwgen.git

Otherwise, you can download pwgen here and run the following command:

pip install pwgen-main.zip

About

A password generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages