From 7a1cadb8cb107a72a270c43de0b39ee3eedab026 Mon Sep 17 00:00:00 2001 From: taxicomics <168220579+taxicomics@users.noreply.github.com> Date: Tue, 14 May 2024 06:41:55 +0000 Subject: [PATCH] rewrite utilzing the "random" library --- CommandLineGenerator.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CommandLineGenerator.py b/CommandLineGenerator.py index dcbe791..cd6922b 100644 --- a/CommandLineGenerator.py +++ b/CommandLineGenerator.py @@ -1,5 +1,6 @@ import hashlib -import secrets +import random +import string def hash_and_average(*values): # Hash each input value @@ -10,8 +11,12 @@ def hash_and_average(*values): average_hash = total_hash // len(hashed_values) # Use the average hash as the seed for random password generation - secrets.seed(average_hash) - password = secrets.token_urlsafe(12) # Adjust the length as needed + random.seed(average_hash) + + # Generate a random password + password_length = 24 # Adjust the length as needed + password_characters = string.ascii_letters + string.digits + string.punctuation + password = ''.join(random.choice(password_characters) for _ in range(password_length)) return password