Skip to main content

Unpredictable random number generation for cryptography (random + secrets module combined.)

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description


secretrandom

The combination of the random and the secrets module for unpredictable number generation

Includes:

  • Password & passcode generation for authentication.
  • Random number generation as the random module.
  • Powered with ⚡true optimization and unpredictability.⚡

Documentation guide

All functions:

  • randpwd() — Password generation
  • randcode() — Passcode and PIN generation
  • randint() — Random whole integer generation
  • randflt() — Random float generation
  • choice() — For random choices
  • shuffle() — For random shuffles

randpwd()

Generates strong or weak passwords based on the length (1st argument) and the strength (2nd argument).


import secretrandom

password = secretrandom.randpwd(17, 'strong')
print(password) # Prints out strong password with 17 chars.
    

NOT RECOMMENDED! Generate weak passwords for examples.


password = secretrandom.randpwd(0, 'weak')
print(password) # Prints out weak password like Tran$f0rm3rsr0ck!
    

randcode()

Generates passcodes or PINs based on the length as the only argument.


passcode = secretrandom.randcode(6)
print(passcode) # Prints out passcode with 6 integers
    

randint()

Random whole integer generator starting from 1st arg to 2nd arg with steps (3rd arg)


random_num = secretrandom.randint(1, 4)
print(random_num) # Prints out a number between 1-4
    

OR


random_num = secretrandom.randint(1, 6, 2)
print(random_num) # Prints out a number either 2, 4, or 6
    

randflt()

Random float generator from 1st arg to 2nd arg


random_flt = secretrandom.randflt(1, 2)
print(random_flt) # Prints out random float from 1 to 2 (like 1.673)
    

choice()

Chooses part of a list of values.


choice = secretrandom.choice('abcd')
print(choice) # Prints out what it chose (either a, b, c, or d)
    

And finally shuffle()

Shuffles a list of values.


data = ['a', 'b', 'c', 'd']
secretrandom.shuffle(data)
print(data) # Shuffles the list of values.
    

Any questions? Email here

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

secretrandom-1.1rc1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

secretrandom-1.1rc1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file secretrandom-1.1rc1.tar.gz.

File metadata

  • Download URL: secretrandom-1.1rc1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for secretrandom-1.1rc1.tar.gz
Algorithm Hash digest
SHA256 5f3e99bc91c71c8d1f32fad721cf3fb107093b190e38800f86df530cd46c9513
MD5 d857a6d8e9f793cad4d2a62614a0bc6a
BLAKE2b-256 e5e23e7dbeb4b0b0c170e0cbccff0a78d6ab011f66878605e8349129e9d2f1d6

See more details on using hashes here.

File details

Details for the file secretrandom-1.1rc1-py3-none-any.whl.

File metadata

  • Download URL: secretrandom-1.1rc1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for secretrandom-1.1rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 671004146d3354cc2fe7c6ec2ef7be680eb3baff4bf74bda753367b5fadf80b4
MD5 05f076dd4fec8fad6891a1ae2184c728
BLAKE2b-256 80ba06b64d69165b563d93a77e18116934a087ac3517a7912bcbc30917be979c

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