Skip to main content

Secure Password Generator and Checker (uses HaveIBeenPwned)

Project description

simple-password-generation

Generate and check secure passwords in Python.

This is intended for use as a password strength checking and suggestion library for APIs, though it could also be integrated into a password database application.

Usage

>>> from simple_pass import create_password, check_havebeenpwned, scoring
>>> password = create_password()
>>> print(password)
unfurcate necessitate nonfact retrogradation swathband orthitic

>>> check_havebeenpwned(password)
True
>>> scoring(password)
(True, 75)

HaveIBeenPwned

Generated passwords are automatically securely checked against the HaveIBeenPwned database. Partial hashes are sent using the HaveIBeenPwned API. This can not be reconstructed to determine the checked password.

User generated passwords can be checked by calling check_havebeenpwned(password).

Scoring Options

Passwords can be checked with a scoring based system using the following options.

def scoring(
    password,
    *,
    minimum_length=8,
    minimum_score=20,
    points_for_lower=2,
    points_for_upper=2,
    points_for_numbers=2,
    points_per_special=2,
    special_characters=" !@#$%^&*()-=_+.,<>[]{}/?\\|",
    points_per_character=1,
):

I believe this scoring system encourages long and difficult to guess passwords by rewarding lengthy passwords and special characters, but without requiring a specific password format or frustrating rules.

XKCD, Comics, Horses, and batteries

For wisdom on what makes a good password see the famous xkcd correct horse battery staple comic. The correct horse battery staple example passes with a score of 36 using the default parameters. It does not pass the HaveIBeenPwned check, however, as it is a well known password that has probably been found in many breaches.

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

simple-pass-1.2.tar.gz (758.8 kB view details)

Uploaded Source

Built Distribution

simple_pass-1.2-py3-none-any.whl (757.8 kB view details)

Uploaded Python 3

File details

Details for the file simple-pass-1.2.tar.gz.

File metadata

  • Download URL: simple-pass-1.2.tar.gz
  • Upload date:
  • Size: 758.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.15.11-76051511-generic

File hashes

Hashes for simple-pass-1.2.tar.gz
Algorithm Hash digest
SHA256 432eb0d54346db5db1c9269a5184e7b0eac85d58cf1295804bb93f897cee78ea
MD5 edc2d5849edef2bb2895e0ad5be34f92
BLAKE2b-256 b201fe76cb57d072a34a4542e1abb3b4f678f0ce24b1b05e597245fafad49899

See more details on using hashes here.

File details

Details for the file simple_pass-1.2-py3-none-any.whl.

File metadata

  • Download URL: simple_pass-1.2-py3-none-any.whl
  • Upload date:
  • Size: 757.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.15.11-76051511-generic

File hashes

Hashes for simple_pass-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a9b2d2343f8f6790e7dee9a5531129aa7a136653f715e3d49c910faed13a239
MD5 184b816165f040f3be574bac48537ba4
BLAKE2b-256 b2d6c7ca7cd796b946a690c9bec643099c4dcde218e4e817869ec49e4f2006b4

See more details on using hashes here.

Supported by

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