commit 385a9e6553ab2b30815937c248137ae8d03c3eaf Author: taxicomics <168220579+taxicomics@users.noreply.github.com> Date: Tue May 14 08:31:30 2024 +0200 Create CommandLineGenerator.py initial ChatGPT version diff --git a/CommandLineGenerator.py b/CommandLineGenerator.py new file mode 100644 index 0000000..dcbe791 --- /dev/null +++ b/CommandLineGenerator.py @@ -0,0 +1,26 @@ +import hashlib +import secrets + +def hash_and_average(*values): + # Hash each input value + hashed_values = [hashlib.sha256(str(val).encode()).hexdigest() for val in values] + + # Calculate the average of the hashed values + total_hash = sum(int(h, 16) for h in hashed_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 + + return password + +def main(): + username = input("Enter your username: ") + password_category = input("Enter the password category (e.g., email, website): ") + password = hash_and_average(username, password_category, input("Enter your password: ")) + + print(f"Generated password: {password}") + +if __name__ == "__main__": + main()