
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
random-password-toolkit
Advanced tools
random-password-toolkit is a robust Python package for generating and managing random passwords with advanced features, including encryption, decryption, strength checking, and customizable generation options. This package is ideal for Python developers looking for a secure and feature-rich solution for handling password-related tasks.
Random Password Toolkit is a robust Python package for generating and managing random passwords, and now also generating random numbers with advanced features. It includes encryption, decryption, strength checking, customizable password generation, and flexible random number generation. This package is ideal for Python developers looking for a secure and feature-rich solution for handling password and number generation tasks.
This package is available through the PyPI registry.
Before installing, ensure you have Python 3.6 or higher installed. You can download and install Python from python.org.
You can install the package using pip:
pip install random-password-toolkit
| Option | Type | Description | Default |
|---|---|---|---|
length | Integer | Length of the password. | 10 |
numbers | Boolean | Include numbers in the password. | false |
symbols | Boolean | Include symbols in the password. | false |
lowercase | Boolean | Include lowercase letters. | true |
uppercase | Boolean | Include uppercase letters. | true |
excludeSimilarCharacters | Boolean | Exclude similar characters (e.g., 'i', 'l'). | false |
exclude | String | Characters to exclude from the password. | '' |
strict | Boolean | Enforce at least one character from each pool. | false |
| Option | Type | Description | Default |
|---|---|---|---|
length | Integer | Number of digits in the generated number. | 6 |
count | Integer | How many numbers to generate at once. | 1 |
as_string | Boolean | Return numbers as zero-padded strings instead of integers. | false |
prefix | String | Optional string to prepend to each generated number. | '' |
suffix | String | Optional string to append to each generated number. | '' |
from random_password_toolkit import (
generate,
generate_multiple,
generate_pronounceable_password,
generate_with_custom_pool,
check_password_strength,
encrypt_password,
decrypt_password,
generate_random_number,
RandomNumberGenerator
)
Generate a single random password with customizable options:
generate_password = generate(5);
console.log(generate_password);
# Output: yKsmtgtDsJ
generate_password = generate(
length=10,
numbers=True,
symbols=False,
lowercase=True,
uppercase=True,
exclude_similar_characters=False,
exclude='',
strict=False)
print("Generated password:", generate_password)
# Output: @D8cP#9Zr2&f
Generate multiple passwords at once:
generate_multiple_password = generateMultiple(5);
console.log(generate_multiple_password);
# Output: ['g8sFwLp4Rx', 'pR2zT9qMf7', ...]
generate_multiple_password = generate_multiple(5, {"length": 8, "numbers": True, "uppercase": True})
print("Multiple passwords:", generate_multiple_password)
# Output: ['Fi:G+D1oTU','jec*<KSP:3','Z@ie>^]n7Q','6&J4O12}e?','K$9J|xDv|Y']
Create passwords that are easier to pronounce:
pronounceable_password = generate_pronounceable_password(length=12)
print("Pronounceable password:", pronounceable_password)
# Output: bolozuna
Generate passwords using a specific set of characters:
generate_with_custom_pool_password = generate_with_custom_pool(length=8, custom_pool="p@ss")
print("Custom pool password:", generate_with_custom_pool_password)
# Output: 2c1ea3fb
Evaluate the strength of a password:
password_strength_checker = "MySecureP@ssword123!"
result = check_password_strength(password_strength_checker)
print(f"Password: {password_strength_checker}")
print(f"Stength: {result}")
print(f"Strength: {result['strength']}")
print(f"Score: {result['score']}")
# Output: Very Strong
Securely encrypt a password:
password = "MySecureP@ssword123!"
// Encrypt the password
encrypted_data = encrypt_password(password)
print("Encrypted Password:", encrypted_data["encrypted_password"])
print("IV:", encrypted_data["iv"])
''' Output:
Encrypted Password: 7de8fc05ab01ed48605fa1983c830e98e13716f507b59bbf1203f7f1361ee497
IV: dc23c48d84eed6b07d89c479af6c5845 '''
Decrypt an encrypted password:
// Decrypt the password using the returned IV
decrypted_password = decrypt_password(encrypted_data["encrypted_password"], encrypted_data["iv"])
print("Decrypted Password:", decrypted_password)
# Output: MySecureP@ssword123!
Test generating zero secrets
try:
print(generate_multiple(0))
except ValueError as error:
print(error)
# output: 'Amount must be greater than 0.'
1. Function-based usage (quick and simple)
from random_password_toolkit import generate_random_number
# -------------------------
# a) Single 6-digit OTP
# -------------------------
otp = generate_random_number(6)
print(f"Your OTP: {otp}") # e.g., "483291"
# -------------------------
# b) Generate multiple order IDs
# -------------------------
order_ids = generate_random_number(6, count=5, as_string=True, prefix="ORD-", suffix="-2025")
print(f"Order IDs: {order_ids}")
# e.g., ["ORD-123456-2025", "ORD-654321-2025", ...]
# -------------------------
# c) Batch processing: generate 100 random numbers for simulation
# -------------------------
batch_numbers = generate_random_number(8, count=100)
print(f"Generated {len(batch_numbers)} 8-digit numbers")
# -------------------------
# d) Database-friendly zero-padded IDs
# -------------------------
db_ids = generate_random_number(10, count=3, as_string=True)
print(f"DB IDs: {db_ids}") # e.g., ["0001234567", "0009876543", "0003456789"]
# -------------------------
# e) Error handling
# -------------------------
try:
generate_random_number(0)
except ValueError as e:
print(f"Error: {e}") # Length must be a positive integer.
2. Class-based usage (advanced/flexible)
from random_password_toolkit import RandomNumberGenerator
rng = RandomNumberGenerator()
# -------------------------
# a) Single 6-digit OTP
# -------------------------
otp = rng.generate(6)
print(f"Your OTP: {otp}")
# -------------------------
# b) Multiple 6-digit invoice numbers
# -------------------------
invoices = rng.generate(6, count=5, as_string=True, prefix="INV-", suffix="-2025")
print(f"Invoices: {invoices}")
# e.g., ["INV-123456-2025", "INV-654321-2025", ...]
# -------------------------
# c) Multiple string IDs for internal tracking
# -------------------------
tracking_ids = rng.generate(8, count=10, as_string=True)
print(f"Tracking IDs: {tracking_ids}")
# -------------------------
# d) Single database key
# -------------------------
db_key = rng.generate(12, as_string=True)
print(f"DB Key: {db_key}") # e.g., "000123456789"
# -------------------------
# e) Advanced usage: repeated calls for batch processing
# -------------------------
for i in range(3):
print(rng.generate(6, as_string=True, prefix="ORD-", suffix=f"-{2025+i}"))
Note: This module has countless use cases and is widely adopted by enterprises for internal applications. It can be easily integrated into various systems, offering secure passwords, unique numbers, and automation capabilities.
We'd love to hear from you and see how you're using Random Password Toolkit in your projects!
For issues, feedback, and feature requests, please open an issue on our GitHub Issues page. We actively monitor and respond to community feedback.
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
random-password-toolkit is a robust Python package for generating and managing random passwords with advanced features, including encryption, decryption, strength checking, and customizable generation options. This package is ideal for Python developers looking for a secure and feature-rich solution for handling password-related tasks.
We found that random-password-toolkit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.