Created
April 16, 2012 03:39
-
-
Save mattgorecki/2396242 to your computer and use it in GitHub Desktop.
Random, readable password generator for building initial passwords during signup
This file contains hidden or 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
import string | |
import itertools | |
import random | |
def gen_pass(): | |
initial_consonants = (set(string.ascii_lowercase) - set('aeiou') | |
# remove those easily confused with others | |
- set('qxc') | |
# add some crunchy clusters | |
| set(['bl', 'br', 'cl', 'cr', 'dr', 'fl', | |
'fr', 'gl', 'gr', 'pl', 'pr', 'sk', | |
'sl', 'sm', 'sn', 'sp', 'st', 'str', | |
'sw', 'tr']) | |
) | |
final_consonants = (set(string.ascii_lowercase) - set('aeiou') | |
# confusable | |
- set('qxcsj') | |
# crunchy clusters | |
| set(['ct', 'ft', 'mp', 'nd', 'ng', 'nk', 'nt', | |
'pt', 'sk', 'sp', 'ss', 'st']) | |
) | |
vowels = 'aeiou' # we'll keep this simple | |
# each syllable is consonant-vowel-consonant "pronounceable" | |
syllables = map(''.join, itertools.product(initial_consonants, | |
vowels, | |
initial_consonants, | |
vowels, | |
final_consonants)) | |
return random.sample(syllables, 1)[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment