Table of Contents
generate()
To generate a password with PyPassPlex, use the generate() function.
import pypassplex as ppx
password = ppx.passgen.generate()
print(password)Arguments
The generate() function takes six optional arguments:
- upper (bool, default=True) - Controls whether uppercase letters are included in the generated password.
- lower (bool, default=True) - Controls whether lowercase letters are included in the generated password.
- numbers (bool, default=True) - Controls whether numbers are included in the generated password.
- symbols (bool, default=True) - Controls whether special characters are included in the generated password.
- length (int, default=10) - Controls the total character length of the generated password.
- returnPool (bool, default=False) - When set to
True, the function returns a tuple containing both the password and the exact character pool string used to build it. This pool string is required if you want to calculate the password’s exact entropy.
entropy()
To determine the password entropy with PyPassKit, use the entropy() function.
import pypassplex as ppx
# 1. Generate the password and fetch the pool
password, charpool = ppx.passgen.generate(length=16, returnPool=True)
# 2. Calculate the total information entropy in bits
bits = ppx.passgen.entropy(pool=charpool, length=len(password))
print(bits)Arguments
The entropy() function takes two mandatory arguments:
- pool (str) - A string containing all unique possible characters that could have been chosen for the password. You can easily get this by setting
returnPool=Truein thegenerate()method. - length (int) - The length of the password string being evaluated.
Errors
The module raises standard Python exceptions with specific error codes when invalid configurations are provided.
-
[201] TypeError Triggered when non-boolean values are passed to the character pool configurations in
generate(). -
[202] TypeError Triggered when a non-integer value is passed for the
lengthargument ingenerate(). -
[203] ValueError Triggered when the requested password
lengthis smaller than the total number of unique character types selected. -
[204] ValueError Triggered when attempting to generate a password with all character categories set to
False. -
[206] TypeError Triggered when a non-integer value is passed for the
lengthargument inentropy(). -
[207] ValueError Triggered when an empty string
""is passed as the character pool toentropy().
Copyright (c) 2026 LukeS-05
PyPassPlex | LukeS-05 | GitHub | Site License