Skip to main content

A library for password hashing and JWT encoding

Project description

Pytography

A Python library that provides secure password hashing and JSON Web Token (JWT) functionality.

Installation

pip install pytography

Quick Start

Password Hashing with Scrypt (Default)

from pytography import PasswordHashLibrary

encoded_password = PasswordHashLibrary.encode(password="password")
is_valid = PasswordHashLibrary.verify(password="password", encoded_password=encoded_password)

Password Hashing with PBKDF2

from pytography import PasswordHashLibrary

encoded_password = PasswordHashLibrary.encode(password="password", algorithm="pbkdf2")
is_valid = PasswordHashLibrary.verify(password="password", encoded_password=encoded_password)

JSON Web Token (JWT)

from pytography import JsonWebToken
from datetime import datetime, timedelta, UTC

jwt = JsonWebToken()
now = datetime.now(UTC)
exp = (now + timedelta(seconds=7200)).timestamp()

# Create a token
token = jwt.encode(payload={"exp": exp, "user_id": 123}, key="key")

# Decode token to get payload
header, payload, signature = jwt.decode(token=token)

# Verify token
is_valid = jwt.verify(token=token, key="key")

License

This project is licensed under the terms of the LICENSE file included in the repository.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

pytography-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

pytography-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file pytography-0.1.0.tar.gz.

File metadata

  • Download URL: pytography-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytography-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0d3f92e2deb955bb958654e6a1f48e7a4fe34b8532beabaa7127c72d95ce93cb
MD5 97a253f128262823bfc253656ea487ea
BLAKE2b-256 b2a7ac435b9176cf60cc0a730f6fce00da32fd751f809779810d6a64e6d11fa8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytography-0.1.0.tar.gz:

Publisher: deploy.yml on TalentGate/pytography

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytography-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytography-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytography-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e9b4e992b94551a40e81a4520a1bb7f27e2833fa3c0186e5143500ad95071dc
MD5 6bce2d2b400c02f140fcf1ee736026d0
BLAKE2b-256 0f33e31c41d398c048ec24db2bbd37bff9efe42a4e224430b869b90987c59792

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytography-0.1.0-py3-none-any.whl:

Publisher: deploy.yml on TalentGate/pytography

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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