Bachelorthesis_Code/backend/src/password_util.py

53 lines
1.1 KiB
Python
Raw Normal View History

from random import seed
from random import randint
import time
seed(int(time.time()))
def get_random_value(list_length):
random_select = randint(0, list_length)
return random_select
def get_random_password():
first_part = [
"Der Vogel",
"Die Ameise",
"Die Biene",
"Ein Mensch",
"Jemand",
]
second_part = [
"frisst",
"küsst",
"begrüsst",
]
third_part = [
"den Vogel",
"die Mücke",
"den Adler",
"den Apfel",
"die Birne",
"die Biene",
"eine Gurke",
]
forth_part = [
"auf der Terasse.",
"auf der Wiese.",
"im Garten.",
"in der Kühltruhe.",
]
password = ""
password += str(first_part[get_random_value(len(first_part)-1)])
password += " " + str(second_part[get_random_value(len(second_part)-1)])
password += " " + str(third_part[get_random_value(len(third_part)-1)])
password += " " + str(forth_part[get_random_value(len(forth_part)-1)])
return password