Random Password Toolkit - Secure Passwords, Tokens, and Data Masking for Python Developers
Managing passwords, tokens, API keys, and sensitive data is a common challenge for developers, especially in AI, RAG, and IoT applications. random-password-toolkit is a Python library that simplifies this by providing a complete, production-ready toolkit for secure credential management.
Features
Password Features
Feature
Description
Random Password Generation
Generate strong and secure passwords.
Generate Multiple Passwords
Create multiple passwords in bulk.
Pronounceable Passwords
Generate passwords easier to read and pronounce.
Custom Password Generation
Use a custom pool of characters.
Password Strength Checker
Evaluate passwords with actionable feedback.
Password Encryption & Decryption
Secure passwords with AES-256 encryption.
Customizable Options
Fully customizable password generation settings.
Random Number Generator Features
Feature
Description
Exact Length Random Numbers
Generate numbers of any specified length.
Multiple Numbers at Once
Generate multiple numbers in one call.
Prefix and Suffix Support
Add custom prefixes or suffixes.
String Formatting
Return numbers as zero-padded strings.
Flexible Usage
Use via a simple function or class.
Lightweight & Production-ready
Fast generation without memory overhead.
Token & API Key Features
Feature
Description
Secure Token Generation
Cryptographically secure tokens using Pythonโs secrets module.
Multiple Token Types
Supports access, refresh, and generic tokens.
Expiry Support
Define expiration time with built-in validation.
API Key Generator
Generate secure keys with configurable bit strength.
Mask any string with configurable visible portions.
Partial Masking
Mask specific sections using index ranges.
Privacy Utilities
Useful for logs, UI display, and data protection.
Benefits
Security: Generate highly secure passwords, tokens, API keys, and unique numbers.
Flexibility: Customize generation and masking to suit any application.
Ease of Use: Simple, intuitive API for beginners and advanced users.
Compatibility: Works seamlessly in Python projects.
Encryption & Decryption: Securely store and retrieve passwords.
Token Management: Manage tokens with expiry support.
API Key Control: Create structured, secure API keys for production.
Data Privacy: Protect sensitive information with masking utilities.
Random Numbers: Generate secure IDs or codes with custom formatting in bulk.
Installation
Ensure Python 3.6+ is installed. Then install via pip:
pip install random-password-toolkit
Options
Password Generation Options
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
Random Number Generation Options
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.
''
Token Generation Options
Option
Type
Description
Default
token_type
String
Type of token: generic, access, refresh.
generic
length
Integer
Length of the generated token.
32
expiry_seconds
Integer / Float
Expiry time in seconds (auto-set for access/refresh if not given).
None
prefix
String (Optional)
Optional prefix to prepend to token.
''
suffix
String (Optional)
Optional suffix to append to token.
''
API Key Generation Options
Option
Type
Description
Default
bits
Integer
Strength of the API key (128, 256, 512, 1024, 2048).
256
char_type
String
Character set: letters, numbers, alphanumeric, mixed.
mixed
separator
String (Optional)
Character used to separate groups (e.g., -).
None
group_size
Integer
Number of characters per group when using separator.
4
expiry_seconds
Integer / Float
Expiry time for the API key in seconds.
None
prefix
String (Optional)
Optional prefix to prepend to API key.
''
suffix
String (Optional)
Optional suffix to append to API key.
''
Data Masking Options
Option
Type
Description
Default
visible_start
Integer
Number of characters to keep visible at the start.
2
visible_end
Integer
Number of characters to keep visible at the end.
2
mask_char
String
Character used for masking.
'*'
start
Integer
Start index for partial masking.
0
end
Integer
End index for partial masking.
None
๐ก Where You Can Use Random Password Toolkit
random-password-toolkit is versatile and production-ready. Here are key areas where it can be applied, highlighting AI, RAG, and security-focused workflows:
1. AI, ML & RAG Applications
Credential Management for AI Services: Generate strong API keys and tokens for AI pipelines, RAG systems, or ML dashboards.
Automated Token Rotation: Quickly rotate access and refresh tokens for AI workflows.
Secure Multi-User AI Systems: Ensure unique, strong passwords for AI dashboards or collaborative ML platforms.
Data Masking for AI/ML Training: Protect sensitive datasets when preparing AI or ML training data.
Random IDs for AI Experiments: Generate unique numeric or alphanumeric IDs for models, experiments, and automated workflows.
2. Web & Mobile Applications
User authentication: Generate strong passwords and secure login credentials.
Top comments (0)