[ACCEPTED]-Any Python password-generators that are readable and pronounceable?-passwords

Accepted answer
Score: 21

If you're really just looking for something 13 "better than I can make up" and "pronounceable," then 12 maybe just use random.sample() to pull from a list of consonant-vowel-consonant 11 pseudosyllables:

import string
import itertools
import random

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, 

# you could trow in number combinations, maybe capitalized versions... 

def gibberish(wordcount, wordlist=syllables):
    return ' '.join(random.sample(wordlist, wordcount))

Then you just choose a suitably 10 large number of "words":

>>> len(syllables)
>>> gibberish(4)
'nong fromp glosk zunt'
>>> gibberish(5)
'samp nuv fog blew grig'
>>> gibberish(10)
'strot fray hag sting skask stim grun prug spaf mond'

My statistics 9 are a little fuzzy, but this may be enough 8 for non-NSA purposes. Note that random.sample() operates 7 without replacement. I should also point 6 out that if a malicious party was aware 5 you were using this method, it would be 4 vulnerable to a dictionary attack. A pinch 3 of salt would help with that.

Update: For those interested, an 2 updated and fork-able version of this is 1 available at https://github.com/greghaskins/gibberish.

Score: 3

You can create a simple Markov text generator and then train 3 it with a list of common/pronounceable words.

Some 2 time ago I wrote a simple generator for 1 fun. Here it is:

#! /usr/bin/python

from cStringIO import StringIO
from sys import argv
import random

USAGE="usage: ./markov.py input_file"

def append(model,token, target):
    if token not in model:

def add_to_model(model,word, end_tag=END_TAG):
    for i in xrange(len(word)-2):
        append(model, word[i:i+2],word[i+2])

def generate(model, end_tag=END_TAG):
    while True:
        if cur==end_tag:
    return ret

if __name__=='__main__':
    if len(argv)>1:
        for word in data:
        print generate(model)
        print USAGE
Score: 3

I'm a big fan of the xkcd password generator. Very customizable, pip 3 installable, and the "acrostic" feature 2 provides a nice way to give users a memory 1 clue for their generated word set.

Score: 2
Score: 1

I guess the project I worked on is applicable. I 5 learned a Markov Model from over 14 million 4 passwords (from the RockYou.com password 3 dump), and created artificial passwords 2 that way. The blog post (and accompanying 1 code) are here. Some sampled artificial passwords:

  • tablester111
  • genny0
  • mikk92
  • lvingree10633769
  • bubuzzarap71666
  • isamistilloro13020
  • dunl0velyiristalecasia4799

More Related questions