Skip to main content

Generate random readable strings for various purposes

Project description

philiprehberger-randstr

Tests PyPI version License

Generate random readable strings for various purposes.

Installation

pip install philiprehberger-randstr

Usage

Random Strings

from philiprehberger_randstr import randstr

randstr(16)                       # "aBx4kLm9pQrS2tUv"
randstr(8, charset="lowercase")   # "abcdefgh"

Tokens and Passwords

from philiprehberger_randstr import token, password

token(32)       # URL-safe base64 token
password(16)    # "aB3$kLm!9pQr#2tU"

Hex and Short IDs

from philiprehberger_randstr import hex_str, uuid_short

hex_str(16)     # "a1b2c3d4e5f6a7b8"
uuid_short()    # "7f3a8b2c"

All generators use the secrets module for cryptographic security.

API

  • randstr(length=16, charset="alphanumeric") — Random string from charset
  • token(length=32) — URL-safe base64 token
  • password(length=16, symbols, min_symbols, min_digits, min_upper) — Strong password
  • hex_str(length=16) — Random hex string
  • uuid_short(length=8) — Short UUID-like hex ID

Development

pip install -e .
python -m pytest tests/ -v

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

philiprehberger_randstr-0.1.7.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

philiprehberger_randstr-0.1.7-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_randstr-0.1.7.tar.gz.

File metadata

  • Download URL: philiprehberger_randstr-0.1.7.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for philiprehberger_randstr-0.1.7.tar.gz
Algorithm Hash digest
SHA256 d55da5a471a3ed9f3bf4e78ac3c27bf747406f221820abc6bdcd07dceb40914d
MD5 69de57c8fe85181e305134fdf8a2223c
BLAKE2b-256 ee99362958b6dadcdd8598850464d67af8f3642ced5a637da4bf129db00233db

See more details on using hashes here.

File details

Details for the file philiprehberger_randstr-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_randstr-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1df0622f218fd370e79c92dc36c1023140db6b9c51811b0787191f5509a875b6
MD5 b50bf13096a1d33a64ce3a1b9b4c4e58
BLAKE2b-256 82ed47078944ac3994be86e8f141a5252e09a3ec6c31c0f7a02bbcb9e3f656aa

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