Skip to main content

strings that are ✨ random ✨

Project description

random-strings

Generate strings that are ✨ random ✨

how to install

$ pip install random-strings

how to use

>>> from random_strings import random_string
>>> random_string(5)
'YSuz5'

advanced usage

from random_strings import random_hex, random_string

password = random_string(16)
SECRET_KEY = random_string(64)

# hexadecimal characters
SECURE_TOKEN = random_hex(128)

# no uppercase letters
verification_code = random_string(12,upper=False)
# only uppercase letters
verification_code = random_string(12,lower=False,digit=False)

# custom characters
characters = '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
verification_code = random_string(12,character_string=characters)

more examples

>>> from random_strings import *

>>> random_hex(16)
'ec583ef0aaa226cba9cb07e3dc2e623c'

>>> random_uuid()
'85273146-3ad8-489f-9964-e7af16ab6a26'

>>> random_uuid(dashes=False)
'a33ee36ad08242e4a2a819147f084a51'

more details

Generated strings are suitable for cryptographically secure usecase

See os.urandom, random.SystemRandom and PEP 506 for more details on how it works.

also, this package is named random-strings. There are other packages on pypi with similar names but they don't do the same thing.

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

random-strings-0.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

random_strings-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file random-strings-0.1.1.tar.gz.

File metadata

  • Download URL: random-strings-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.9

File hashes

Hashes for random-strings-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7742875e33dc05be1c91078b169b646248a84f8b621a8b1c2fa75ce5a41b06da
MD5 0b4bbb606e721f796dae8fdc48cb1956
BLAKE2b-256 585d0ae1028d95a698c10fe4f52ced0ff1ee5e312151fd0c4d36451d099a6300

See more details on using hashes here.

File details

Details for the file random_strings-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: random_strings-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.9

File hashes

Hashes for random_strings-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab838308f8ecf5e9e1282b685709d733548f8518926329684ff05fb886894b27
MD5 8b83f91e7bd64d4c7e0b73b0a53b2659
BLAKE2b-256 f3d037e9ce76639efe1c8d07100f9546f06b0dcb15343b9b8ed4e38c1ec10764

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