4 A flexible and scriptable password generator which generates strong passphrases, inspired by `XKCD 936 <http://xkcd.com/936/>`_::
7 > correct horse battery staple
9 .. image:: http://imgs.xkcd.com/comics/password_strength.png
16 ``xkcdpass`` can be easily installed using pip::
22 python setup.py install
28 The latest development version can be found on github: https://github.com/redacted/XKCD-password-generator
30 Contributions welcome and gratefully appreciated!
37 Python 2.4+ (Python 3.x compatible)
44 ``xkcdpass`` can be called with no arguments::
47 > pinball previous deprive militancy bereaved numeric
49 which returns a single password, using the default dictionary and default settings. Or you can mix whatever arguments you want::
51 $ xkcdpass --count=5 --acrostic='chaos' --delimiter='|' --min=5 --max=6 --valid_chars='[a-z]'
52 > collar|highly|asset|ovoid|sultan
53 > caper|hangup|addle|oboist|scroll
54 > couple|honcho|abbot|obtain|simple
55 > cutler|hotly|aortae|outset|stool
56 > cradle|helot|axial|ordure|shale
60 * ``--count=5`` 5 passwords to choose from
61 * ``--acrostic='chaos'`` the first letters of which spell 'chaos'
62 * ``--delimiter='|'`` joined using '|'
63 * ``--min=5 --max=6`` with words between 5 and 6 characters long
64 * ``--valid_chars='[a-z]'`` using only lower-case letters (via regex).
67 A concise overview of the available ``xkcdpass`` options can be accessed via::
71 Usage: xkcdpass [options]
75 show this help message and exit
76 -w WORDFILE, --wordfile=WORDFILE
77 List of valid words for password
79 Minimum length of words to make password
81 Maximum length of words to make password
82 -n NUMWORDS, --numwords=NUMWORDS
83 Number of words to make password
85 Interactively select a password
86 -v VALID_CHARS, --valid_chars=VALID_CHARS
87 Valid chars, using regexp style (e.g. '[a-z]')
89 Report various metrics for given options
90 -a ACROSTIC, --acrostic=ACROSTIC
91 Acrostic to constrain word choices
92 -c COUNT, --count=COUNT
93 number of passwords to generate
94 -d DELIM, --delimiter=DELIM
95 separator character between words
98 A large wordlist is provided (courtesy of `12Dicts <http://wordlist.aspell.net/12dicts/>`_) for convenience, but the generator can be used with any word file of the correct format: a file containing one 'word' per line. The default word file can be found in ``xkcdpass/static/default.txt``.
105 The built-in functionality of ``xkcdpass`` can be extended by importing the module into custom python scripts.
106 An example of this usage is provided in `example_import.py <https://github.com/redacted/XKCD-password-generator/blob/master/xkcdpass/example_import.py>`_, which randomly capitalises the letters in a generated password.
108 A simple use of import::
110 import xkcdpass.xkcd_password as xp
112 ## create a wordlist from the default wordfile
113 ## use words between 5 and 8 letters long
114 wordfile = xp.locate_wordfile()
115 mywords = xp.generate_wordlist(wordfile=wordfile, min_length=5, max_length=8)
117 ## create a password with the acrostic "face"
118 print(xp.generate_xkcdpassword(mywords, acrostic="face"))
124 This is free software: you may copy, modify, and/or distribute this work under the terms of the BSD 3-Clause license.
125 See the file ``LICENSE.BSD`` for details.