Compare commits

..
2 Commits
Author SHA1 Message Date
christopher 652ffc1a46 Keep remote .gitignore from Gitea 2026-09-11 21:39:28 -04:00
christopher 13d9561313 Initial commt 2026-09-11 21:12:11 -04:00
+30
View File
@@ -0,0 +1,30 @@
import secrets
import string
# 1. Define your character groups
letters = string.ascii_letters
digits = string.digits
special = "!@#$%^&"
# 2. Combine all characters for the "pool"
all_characters = letters + digits + special
# 3. Start the password with one guaranteed character from each group
password_list = [
secrets.choice(letters),
secrets.choice(digits),
secrets.choice(special)
]
# 4. Fill the remaining length (16 - 3 = 13 characters) from the full pool
password_list += [secrets.choice(all_characters) for _ in range(13)]
# 5. Shuffle the list so the guaranteed characters aren't always at the start
# We use secrets.SystemRandom() to ensure the shuffle is cryptographically secure
secrets.SystemRandom().shuffle(password_list)
# 6. Join into a single string
password = "".join(password_list)
print(password)