feat: password generator using pet names and random number
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import petname
|
||||||
|
import secrets
|
||||||
|
|
||||||
|
def generate_password(names: int) -> str:
|
||||||
|
"""
|
||||||
|
Generate a password from pet names and a random number
|
||||||
|
|
||||||
|
:param names: Number of names to generate
|
||||||
|
:return: A simple yet secure password
|
||||||
|
"""
|
||||||
|
results = []
|
||||||
|
for _ in range(names):
|
||||||
|
results.append(petname.Name().capitalize())
|
||||||
|
results.append(str(secrets.randbelow(8999)+1000))
|
||||||
|
return ".".join(results)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(generate_password(2))
|
||||||
Reference in New Issue
Block a user