diff options
Diffstat (limited to 'comp/work/14/passwordgen.py')
-rw-r--r-- | comp/work/14/passwordgen.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/comp/work/14/passwordgen.py b/comp/work/14/passwordgen.py new file mode 100644 index 0000000..d052745 --- /dev/null +++ b/comp/work/14/passwordgen.py @@ -0,0 +1,33 @@ +import random, sys + +def randomchar(): + num = random.randint(65, 90) + return chr(num) + +def fliprandom(char): + if random.randint(0,1) == 0: + return char.lower() + else: + return char + +def usenumber(char): + if random.randint(0,3) == 0: + return ord(char) + else: + return char + +def shift(char): + if random.randint(0,1) == 0: + return chr(random.randint(58, 63)) + else: + return char + +password = [] + +for i in range(30): + password.append(usenumber(fliprandom(shift(randomchar())))) + +for i in password: + sys.stdout.write(str(i)) + +print("") |