Created
September 2, 2018 05:24
-
-
Save owenthewizard/ea8b2b00d00fc03182635bf16c1468a6 to your computer and use it in GitHub Desktop.
Simple password generator. Probably not secure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# genpass by owenthewizard | |
from os import urandom | |
from base64 import b64encode | |
config = { | |
# Number of bytes of entropy to use when generating password | |
"bytes": 16, | |
# Limit password to this many characters | |
"chars": 8 | |
} | |
# Characters that look too similar in many fonts or are otherwise unsuitable | |
# for passwords | |
# Equals sign is padding for base64 | |
bad_chars = {"1": "", "l": "", "O": "", "0": "", "=": ""} | |
# Yuck! | |
print(b64encode(urandom(config["bytes"])).decode("utf-8").translate(bad_chars)[:config["chars"]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment