Merge branch 'xkcd-pwd' into 'master'

Xkcd password

A password generator a suggested by : https://xkcd.com/936/

See merge request free_zed/mypsb!1
This commit is contained in:
Freezed 2020-03-10 20:19:28 +00:00
commit 85df8b487f
2 changed files with 19 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*__pycache__*
.scores
*/.*
*.pyc

18
xkcd-password.py Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# coding: utf8
"""
Author: freezed <git@freezed.me> 2020-01-16
Licence: `GNU GPL v3` GNU GPL v3: http://www.gnu.org/licenses/
Inspiration:
- https://docs.python.org/3/library/secrets.html#recipes-and-best-practices
- https://xkcd.com/936/
"""
import secrets
with open("/usr/share/dict/words") as f:
words = [word.strip() for word in f if len(word) == 7]
for i in range(10):
password = "-".join(secrets.choice(words) for i in range(5))
print(password)