smartrandom
Random data generators
Generate random strings from letters, numbers and symbols, randomize text, generate passwords, service codes, hashes, and smart recoverable passwords.
smartrandom — random data generators. Allows you to generate random strings of a given length from letters, numbers and symbols, as well as randomize text.
Helps generate passwords, service codes (for example, for sending via SMS), hashes and much more. Generates smart, recoverable passwords.
- Random Strings — from letters, numbers and symbols
- Text Randomization — variable text with curly brace syntax
- Password Generation — base and smart recoverable passwords
- Secret Codes — service codes for SMS, etc.
- Hashes — SHA-512 hash generation
- Random Hex Strings — cryptographically secure
- Random Bytes — secure random bytes
- Deterministic Smart Passwords — same seed = same password
- 100% Test Coverage — fully tested
Syntax: {Salute|Hello|Good morning} {comrade|buddy|dear friend}!
Possible results:
- Salute comrade!
- Salute buddy!
- Hello comrade!
- Good morning dear friend!
Basic elements:
{}— group text options for random selection|— separate different text options within braces
pip install smartrandom
from smartrandom import RandomDataGenerator, TextRandomizer
# Secret code
secret_code = RandomDataGenerator.generate_secret_code(length=6) # 'zREkjF'
# Random numbers
number_secret_code = RandomDataGenerator.generate_random_numbers(length=6) # '986741'
# Random symbols
symbols = RandomDataGenerator.generate_random_symbols(length=10) # '&&!@@&@!_!'
# Hash
hash_ = RandomDataGenerator.generate_hash(text='text') # SHA-512 hash
# Random hex string
urandom_string = RandomDataGenerator.generate_random_hex_string(size=32)
# Random bytes
urandom_bytes = RandomDataGenerator.generate_random_bytes(size=32)
# Text randomization
randomized_text = RandomDataGenerator.randomize_text(
'{Salute|Hello|Good morning} {comrade|buddy|dear friend}!'
) # 'Good morning buddy!'
# Or using TextRandomizer
text = '{Salute|Hello|Good morning} {comrade|buddy|dear friend}!'
randomized_text = TextRandomizer.randomize(text)
# Base password
base_password = RandomDataGenerator.generate_base_password(length=15) # '$yE$JL8heeJQv5X'
# Smart passwords (deterministic)
smart_password1 = RandomDataGenerator.generate_smart_password(seed='test', length=15) # 'GEyfYrC%VJU!RSY'
smart_password2 = RandomDataGenerator.generate_smart_password(seed='test2', length=15) # '2PhIQt8pIke9c@m'
# Same seed = same password
smart_password3 = RandomDataGenerator.generate_smart_password(seed='test', length=15) # 'GEyfYrC%VJU!RSY'
| Method | Description |
|---|---|
generate_secret_code(length) | Random string from letters and digits |
generate_random_numbers(length) | Random numeric string |
generate_random_symbols(length) | Random symbols string |
generate_hash(text) | SHA-512 hash |
generate_random_hex_string(size) | Cryptographically secure hex string |
generate_random_bytes(size) | Cryptographically secure bytes |
randomize_text(text) | Randomize text with syntax |
generate_base_password(length) | Base random password |
generate_smart_password(seed, length) | Deterministic smart password |
100% test coverage — All components thoroughly tested.
Run tests:
pip install pytest pytest -v
Coverage report:
pip install pytest-coverage pytest --cov pytest --cov --cov-report=html
By using this software, you agree to the full disclaimer terms.
Software provided "AS IS" without warranty. You assume all risks.
Full legal disclaimer: See DISCLAIMER.md
License: BSD 3-Clause License