Git Product home page Git Product logo

passphraseme's Introduction

passphraseme

A quick and simple cryptographically secure script to generate high entropy passphrases using the Electronic Frontier Foundation's wordlists, including their fandom-inspired wordlists.

Installation

pip3 install passphraseme

Usage

Run passphraseme with a number to generate secure passphrases using EFF's short wordlist, like this:

$ passphraseme 7
plug-scan-skate-shown-ritzy-self-bud
$ passphraseme 5
drank-amino-spoil-badge-copy

You can also optionally choose a different wordlist. Here are all of the command line arguments:

Short Long Description
-h --help show help message
--sep Separator (default "-")
-l --large Use EFF's general large wordlist
-s1 --short1 Use EFF's general short wordlist (default)
-s2 --short2 Use EFF's short wordlist with unique prefixes
-got --game-of-thrones Use EFF's Game of Thrones wordlist (Passwords of Westeros)
-hp --harry-potter Use EFF's Harry Potter wordlist (Accio Passphrase!)
-st --star-trek Use EFF's Star Trek wordlist (Live Long and Passphrase)
-sw --star-wars Use EFF's Star Wars wordlist (The Passphrase Is Strong With This One)
-d [dictionary] --dictionary [dictionary] Custom wordlist filename

For example, you can choose to EFF's short wordlist with unique prefixes like this:

$ passphraseme -s2 5
leftover-human-podiatrist-clergyman-elk

Or you can embrace your inner nerd and use a fandom wordlist:

$ passphraseme --game-of-thrones 5
skull-putting-twenty-aid-bluntly
$ passphraseme --harry-potter 5
summoning-jealous-loads-somehow-unregistered
$ passphraseme --star-trek 5
destroying-maximum-radiation-yells-causes
$ passphraseme --star-wars 5
duels-zett-rock-silenced-blockade

You can also choose to use a custom wordlist, like this:

$ passphraseme -d /usr/share/dict/words 7
Sphinx's-congas-adjudge-revalue-scotched-decapitations-scampered

And if you prefer, you can use a custom separator, like or . instead of -:

$ passphraseme --sep " " 5
drown elder drown sport hula
$ passphraseme --sep . 5
stage.stash.speak.shack.pound

Strength of passphrases

This table shows the strength (bits of entropy) of passphraseme-generated passphrases of different lengths (1-10 words).

Bits of entropy/word 1 2 3 4 5 6 7 8 9 10
EFF large wordlist (default) 12.925 12.9 (0 s) 25.8 (0 s) 38.8 (0 s) 51.7 (1 h) 64.6 (1 y) 77.5 (10.6k y) 90.5 (82M y) 103.4 (642B y) 116.3 (4.99e15 y) 129.2 (3.88e19 y)
EFF short wordlists 10.339 10.3 (0 s) 20.7 (0 s) 31.0 (0 s) 41.4 (4 s) 51.7 (1 h) 62.0 (83 d) 72.4 (295 y) 82.7 (382.3k y) 93.1 (495M y) 103.4 (642B y)
EFF fandom wordlists 11.965 12.0 (0 s) 23.9 (0 s) 35.9 (0 s) 47.9 (6 m) 59.8 (17 d) 71.8 (196 y) 83.8 (787.1k y) 95.7 (3B y) 107.7 (1.26e13 y) 119.7 (5.04e16 y)

The brute force time is calculated like this:

I'm assuming you're using a passphrase for macOS 10.8+ (PBKDF2-SHA512) to encrypt your disk with FileVault. According to this post, the password cracking tool hashcat can guess 193,900 passphrases per second on an Amazon AWS p3.16xlarge instance, which costs $24.48 per hour.

If an attacker is willing to spend up to $1 billion per day to guess your passphrase, they can afford to run 1.7 million of these AWS instances at once, meaning they can guess ~330 billion passphrases per second. On average, a brute force attack will find the passphrase after searching half the keyspace, so the times above are how long it takes to search half the keyspace.

Note that the time "3.88e19 y" means "3.88 x 1019 years". Also note that the brute force times will vary wildly, both much quicker or much slower, depending on the hash function or KDF used -- basically, depending on what software you're using this passphrase with.

Check out calc_passphrase_strength.py to see the maths.

Licenses

The wordlists included were created by Electronic Frontier Foundation, and are distributed under the Creative Commons Attribution 3.0. For the fandom wordlists (Game of Thrones, Harry Potter, Star Trek, and Star Wars), EFF notes that "Any trademarks within the word list are the property of their respective trademark holders, who are not affiliated with the Electronic Frontier Foundation and do not sponsor or endorse these passwords."

passphraseme's People

Contributors

42b avatar agucova avatar delirious-lettuce avatar micahflee avatar sibowyer avatar steap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

passphraseme's Issues

Ability to check generated passphrases againsts list of leaked passwords.

It would be nice to have the option to check generated passphrases against the list of leaked passwords from sources like Pwned Passwords which contains list of more than half a billion passwords which have previously been exposed in data breaches.

Pwned Passwords also implements a k-Anonymity model that allows a password to be searched for by partial hash.

If the user opts for checking the passphrases against the Pwned Passwords and it is found in the list then a new password should be generated for the user. This issue is inspired by the a Computerphile video.

A hard dependency on Python 3.6 is needed to avoid fatal errors

I got an error trying to use passphraseme that was due to my system being Debian Jessie, which is Python 3.4, and so it lacks the 'secrets' module.

miguel@syrah:~$ passphraseme 
Traceback (most recent call last):
  File "/usr/local/bin/passphraseme", line 7, in <module>
    from passphraseme import main
  File "/usr/local/lib/python3.4/dist-packages/passphraseme/__init__.py", line 6, in <module>
    from secrets import choice
ImportError: No module named 'secrets'

Is there a way to prevent the installation on a < 3.6 system via pip to avoid the false expectation? Maybe a hard dependency is needed somewhere? Otherwise an addition to the README.md is maybe good enough.

Non-uniquely decodable word lists and "" separator can lead to issues

Passphraseme allows users to not use a word separator with --sep ""; for example passphraseme -sw --sep="" might give: "givenopportunityionreportedrimslukeshowed".

Passphraseme also allows users to use the EFF fandom lists, which are not uniquely decodable. For example, "light", "saber" and "lightsaber" are all on the Star Wars list. This can be an issue if a user runs passphraseme -sw --sep="" 5, expecting a 5-word passphrase and all the entropy that entails (about 60 bits), but instead gets "helplessyachtdecemberlightsaber", which is effectively a 4-word passphrase, giving only about 48 bits of entropy (again, this is because "lightsaber" is a single word on the list).

The EFF long and short lists avoid this issue because they do not have prefix words: "We also ensured that no word is an exact prefix of any other word." If we removed all prefix words from the fandom lists, we'd remove "light", since it's a prefix word of "lightsaber", and would avoid the issue described above.

Is this a serious, real-world issue?

Honestly, I've never been confident about a mathematical procedure to, given a not uniquely decodable list, calculate the actual chance of one of these issues actually happening. The issue also assumes that the attacker knows the word list that you used to create your passphrase and is brute-forcing through all possible 1-word passphrases, 2-word passphrases, 3-word passphrases, 4-word passphrases (where they would guess "helplessyachtdecemberlightsaber"!), etc..

But I've always thought there was good reason for EFF to remove prefix words on the long and short non-fandom lists. (And for 1Password's passphrase generator to require word separators.) tbh I'm kind of disappointed EFF didn't do the same for the fandom lists.

Possible solutions for Passphraseme

  1. Force users to use a separator of some kind (in other words, do not accept a separator of ""), as 1Password's passhrase generator does.
  2. Capitalize the first letter of each word if --sep is set to "". These capitalized letters effectively act as word separators ("LightSaber" vs. "Lightsaber").
  3. Make all word lists uniquely decodable, either by removing all prefix words or another method (I have a preferred method). This solution has the disadvantage of making combining word lists, as requested in #18, complicated, as combining 2 or more uniquely decodable word lists will very likely result in a list that is NOT uniquely decodable.

Custom wordlist

As a suggestion, a simple function to retrieve a custom (.txt) wordlist could be useful.
Working implementation:
Argument:

parser.add_argument('-d', '--dictionary', nargs='?', metavar='dictionary', help='Dictionary file')

Reading:

if args.dictionary is not None:
        with open(args.dictionary) as f:
            words = [line.rstrip('\n') for line in open(args.dictionary)]

Example:

words

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.