Coder Social home page Coder Social logo

danstiner / password-generator Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 3.0 1.6 MB

Secure multi-word passphrases generated in your browser

Home Page: https://passphrase.danielstiner.me/

HTML 3.15% JavaScript 76.19% CSS 19.44% Shell 1.09% Makefile 0.13%

password-generator's People

Contributors

danstiner avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

l0ck-h mirab242

password-generator's Issues

Generate multiple passwords at once

I often find myself refreshing a couple times to find a password I like. In the worst case this means losing one bit of entropy per refresh.

Instead showing a few suggestions at once would lose less entropy. An odd number would be best as it gives an obvious choice if you are in a hurry, the middlemost one. So three or five suggestions seems like a good number.

To give exact numbers, assuming I look at five suggestions before picking one:

  • Refreshing five times would lose 5 bits of entropy worst case
  • Showing all five to begin with would lose about 2.3 bits of entropy, much more reasonable.

getRandomSymbol is slightly biased

Currently symbols are chosen from an alphabet by just modding a uin32 down to the length of the alphabet, this can introduce bias for non-power-of-two alphabet sizes of about 2^-32 - 2^-log2(|alphabet|) or about 1/2^21 for a wordlist with about two thousand words. This is small but not entirely negligible and should be fixed.

symbol: alphabet[randomValues[0] % alphabet.length],

Relevant reference: https://stackoverflow.com/questions/137783/expand-a-random-range-from-1-5-to-1-7

Simplify theme

Removing bootstrap and replacing it with a small amount of custom CSS will be easier to audit.

Generate (password, passphrase) pairs

This has always been the goal of the project: to generate passwords that are short, secure, and easy to remember. This is assisted by generating a corresponding passphrase that helps with remembering the password (by being a mnemonic device) (and is just as secure by being one-to-one with the password).

This is largely inspired by the Schneier scheme, but focused on having enough entropy to resist attacks over having a form of password that would not be tested by a brute force algorithm. So the threat model and entropy estimate assume a worst case of the attacker knowing the generation algorithm used and thus the form of the password.

I spent a long time thinking about this before coming to the realization that it can be done (while maintaining the one-to-one mapping) by simply applying lossless compression to the passphrase to derive a much shorter password. One decent method using prefix codes. Build a trie from all word alternatives and then use the prefix for the randomly chosen word. This forms a uniquely decodable code which ensures password to passphrase is one-to-one. And since they are prefixes, they make decent mnemonics. This can be further enhanced by first applying a mapping that reduces prefix collisions (say mapping "seven" to "7"), leading to shorter passwords.

Pare down to a single word list

Diceware and other wordlists already have generation methods, better to aim for a single "best" word generation algorithm than to support multiple.

Store wordlists as JSON

Currently wordlists are loaded as a javascript file, this is simple but requires trusting some bad javascript is not hiding in the middle of a massive file. It would be easier to audit if they were stored as a JSON file and loaded via XMLHttpRequest

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.