Countersign
countersign - A signal or password given in reply to a soldier on guard.
Countersign is a light-weight python library for generating highly customizable passwords.
Installation
Requires python 3.6 or above
pip install countersign
Usage
Passwords
In countersign terms passwords are simply random character strings that are slightly configurable.
To generate a random password, import the password() function.
from countersign.password import password
# By default, generates some random password using 'string.printable' characters of length 8
generated_password = password()
Configuration can be accomplished as seen below.
from countersign.password import password
# Generates password of all unique characters using
# the characters '12345' with a length of 2
generated_password = password(characters='12345', length=2, unique=True)
If you require multiple random passwords to be generated at a time, use the passwords() function. The function returns a python generator that yields an unlimited count of random passwords and can bee configured the same as the password() function.
from countersign.password import passwords
# Returns a python generator capable of producing passwords with default characteristics
password_generator = passwords()
Passphrases
Passphrases are more structured passwords following certain configured patterns and even using given world dictionaries. Completely random passwords are great but sometimes a more human memorable pattern is more ideal.
Similar to passwords, passphrases can be constructed and configured the same way.
from countersign.passphrase import passphrase
words = ['Test', 'Word', 'More', 'Words']
# Passphrase using the words [Test, Word, More, Words] with no digit generation strategy. By default the passphrase consists of three given words.
# Produces something like: WordMoreTest
generated_passphrase = passphrase(words)
Passphrases can also be configured with a digit generation strategy which tells the passphrase generator to inject digit groups wherever specified.
from countersign.passphrase import passphrase, DigitGenerationStrategy, DigitPlacementStrategy
words = ['Test', 'Word', 'More', 'Words']
strategy = DigitGenerationStrategy(digit_count=3, placement=DigitPlacementStrategy.AFTER)
# Produces something like: WordWordsTest947
generated_passphrase = passphrase(words, digit_strategy=strategy)
Digit placement strategies include:
-
BEFORE
123TestWords -
AFTER
TestWords123 -
BEFORE_AND_AFTER
123TestWords123 -
IN_BETWEEN
Test123Words -
AROUND
123Test123Words123
Metadata
Release files for countersign 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| countersign-0.1.0.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| countersign-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / countersign-0.1.0.tar.gz
| Download URL | countersign-0.1.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4cac05b4390c1991191015327f0114b517229c5a15c24a85e70f9e123f945906
|
|
BLAKE2b-256 checksum How to use checksums |
29924c2a01fbbee9d95626f83c6ec52c701a98fe7e66dbf9aed6b8913d87fba7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|
Release files / countersign-0.1.0-py3-none-any.whl
| Download URL | countersign-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
679c6bc1ae482a284aca718c7f6ce1b0201410659a8cdcb90218c156c55be55b
|
|
BLAKE2b-256 checksum How to use checksums |
937db61e35ba140ca78579e5b72719fe62e2d1f3153ccc299f697c3c488ad1c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|