Bachelorthesis_Code/backend/src/password_util.py
cami 5e07b3b7dd
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
Added some more words for password generator
2021-07-17 01:45:29 +02:00

60 lines
1.2 KiB
Python

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",
"Der Hund",
"Der Kater",
]
second_part = [
"frisst",
"küsst",
"begrüsst",
"besucht",
"beeinflusst",
"isst",
"findet",
"vergisst",
]
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.",
"auf dem Balkon.",
]
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