Skip to main content

Library for generating random passwords

Project description

passthon

passthon is a Python library for easily generating random passwords.

Installation

Use the package manager pip to install passthon.

pip install passthon

Usage

First, you need to import the library into your script.

import passthon

The password class

The password class is the main (and the only) class in the passthon module. You will need to directly instantiate it in order to generate passwords.

mypassword = passthon.password(length[,options])

Parameters:

Name Type Description Default
length int The length of the password(s) you want to generate. Doesn't have a default value. You need to specify the length.
lc bool Include lowercase letters. Defaults to True
uc bool Include uppercase letters. Defaults to False
num bool Include numbers. Defaults to True
sym bool Include lowercase characters. Defaults to False

Example: This example corresponds to a 10-character password with only uppercase letters and numbers.
Remember that lc and num parameters are True by default.

mypassword = passthon.password(10, lc=False, uc=True)

Functions

The gen() function

To generate a password based on the previous parameters, you will need to call the gen() function on the instance you previously created.

mypassword.gen()
# This will return a randomly generated password.

The gen_multi() function

Similar to the gen() function, but this one generates more than one password. You will need to specify the amount of passwords you want to generate.

mypassword.gen_multi(amount)
# This will return a certain amount of passwords as a list.

As this function returns a list, you can access each one of the passwords through their index, or even join them in a single string.

Example:

list = mypassword.gen_multi(10)
print(list[3])
# This will print password 4 of 10

string = '-'.join(list)
print(string)
# This will print all 10 passwords separated by a dash (-)

The print() function

This function will directly print a previously generated password. If there's no password generated, it will automatically generate one and print it.

When used in a multi-password context, it prints the list one by one.

mypassword.print()

Contributing

Pull requests are welcome. Also, if you find any problem or error, feel free to contact me. :D

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

passthon-0.0.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

passthon-0.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file passthon-0.0.1.tar.gz.

File metadata

  • Download URL: passthon-0.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for passthon-0.0.1.tar.gz
Algorithm Hash digest
SHA256 beb2dfb5f5c82e6d5b6dd1e555a934507d51ca65e1b75a08e05e9373f02d4b81
MD5 4e005b1ea630f42617a6502cf671e647
BLAKE2b-256 ad4558da63efef5d724c70567aff858e91da637a72be5d08b5dd4dbe7c660f64

See more details on using hashes here.

File details

Details for the file passthon-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: passthon-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for passthon-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a7ac0582a28210c1d788605dd5f570e786cbc0360dcd864f0311b0b73ceec82
MD5 e2a603e6e28e447d56f860083d42dbe5
BLAKE2b-256 20bd7fe17f64533ec5b6a5bb90ce74e73a81bace30b2922f62c95ea58f7feaa2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page