Create CommandLineGenerator.py

initial ChatGPT version
This commit is contained in:
taxicomics 2024-05-14 08:31:30 +02:00 committed by GitHub
commit 385a9e6553
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 26 additions and 0 deletions

26
CommandLineGenerator.py Normal file
View File

@ -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()