Created
November 29, 2017 11:04
-
-
Save apettinen/80b6150e034650784973e66801e23452 to your computer and use it in GitHub Desktop.
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/python | |
# Will loop until string contains other than strings and digits | |
# sets of strings and digits | |
# depends on your local, see locale.getlocale() and locale.setlocale() | |
# by default this is non-scandic, i.e. basic A-Z,a-z and 0-9 | |
import strings | |
import os | |
strings_and_digits = string.letters+string.digits | |
while True: | |
gens=os.urandom(33).encode('base64').strip('\n') | |
if not all(character in strings_and_digits for character in gens): | |
print("contains other than letters and digits") | |
print("%s" %gens) | |
break | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment