GithubHelp home page GithubHelp logo

dmuth / diceware Goto Github PK

View Code? Open in Web Editor NEW
206.0 6.0 50.0 7.85 MB

Generate secure passwords you can actually remember!

Home Page: https://diceware.dmuth.org/

License: Apache License 2.0

CSS 0.03% JavaScript 99.29% HTML 0.49% PHP 0.12% Shell 0.05% Dockerfile 0.02%
diceware security password password-generator web bootstrap

diceware's Introduction

Diceware

Feel free to check out the live version at https://diceware.dmuth.org/

Weak passwords are a big flaw in computer security due to a lack of "entropy" or randomness. For example, how many times have you used the name of a pet or relative or street in a password, or perhaps the number "1". Not very random, is it? :-) Worse still, if passwords are reused between services, that increases your security risk.

Fact is, humans are terrible at remembering random combiations of letters and numbers, but we are great at remembering phrases of words. That's where Diceware comes in.

Diceware is based on the proposal at http://world.std.com/~reinhold/diceware.html wherein virtual dice are roled 5 times, and the 5 digit number used against a lookup table of words. 4 dice rolls gives you 4 random words which are easy for a human being to remember, yet have a high amount of entropy which makes them hard to crack.

For more information on Diceware:

Can I run this on my own computer without using your website?

Yes! Go to https://github.com/dmuth/diceware/releases and download the latest diceware.zip file. When you unzip that file, the contents will be written to a directory called diceware/. You can then point a webserver on your machine to diceware/index.html in order to use Diceware.

Sadly, you cannot open diceware/index.html directly, as the CORS policy in Chrome prevents that. If you know of a way to fix that, please open an issue. :-)

Will this work on an iPhone?

Yep! It should work on any mobile phone or tablet that supports Javascript, but I have only tested it on an iPhone 5S at this time.

Will this work in an air-gapped environment?

Yes, copies of assets such as Bootstrap and jQuery have been made, and Diceware can now be run without requiring an Internet connection.

Development

This app is built with Webpack.

When done editing main.js, the packed file can be built by simply running webpack on the command line. It will be writing to dist/bundle.js. To run webpack in a mode so that it regularly checks for changed files, run webpack --watch --mode development.

In a move that departs from Best Practices, I have made the decision to include the packed file in Git. My reason for this is that the software will be ready to run as soon as it is checked out (or a ZIP is downloaded), and that is a key design feature of this app--I want it to be as easy to get up and running as possible.

A local webserver can be set up by running npm install http-server -g to install it, then http-server to listen on http://localhost:8080/

In summary:

  • Development
    • npm run clean - Cleanup after a previous run
    • npm install - Install NPM packages used by Diceware
    • npm run dev-build - Run webpack to pack Javascript files and watch for changes.
    • http-server
    • vim src/lib.js src/index.js
      • Be sure to check in your changes before the next step!
  • Testing
    • rm -fv src/index.js && git co src/index.js - Get the new SHA1 hash that will be displayed in debug messages.
      • The hash can be crosschecked with the results of git hash-object src/index.js
    • npm test - Make sure you didn't break any of the core logic!
    • npx cypress run - Run front-end testing
      • If the tests break, run npx cypress open to run tests interactively.
  • Deployment
    • npm run build - Webpack Javscript files in production mode (smaller file but takes longer)
    • ./go-sync-to-s3.sh - Do this if you're me, to upload to S3. If you're not me, you'll need to do something else, or possibly nothing at all.

In practice:

  • npm run clean; npm run dev-build - Run webpack in dev mode while working on Javascript
    • http-server - Stand up a local HTTP server
    • vim src/lib.js src/index.js
    • rm -fv src/index.js && git co src/index.js
  • npm run clean; npm run build - Run webpack in prod mode to produce final Javascript bundle
  • ./go-sync-to-s3.sh - Do this if you're me, to upload to S3. If you're not me, you'll need to do something else, or possibly nothing at all.

Releasing a New Build

  • npm run release-build to create the ZIP file diceware.zip with all assets in it, including bundle.js and the contents of node_modules/.
  • gh release create v1.0.1 to upload a release to https://github.com/dmuth/diceware/releases.
    • Change the tag for the version number accordingly.
  • gh release upload v1.0.1 diceware.zip to upload the ZIP file containing everything

Development In Docker

Wanna develop in Docker? We got you covered. Here are some helper scripts:

  • bin/docker-build.sh - Build the Docker copntainer
  • bin/docker-dev.sh - Run in dev mode--listening on http://localhost:8000/
  • bin/docker-prod.sh - Run in prod mode--listening on http://localhost:80/
  • bin/docker-push.sh - Push to Docker Hub

Who built this? / Contact

My name is Douglas Muth, and I am a software engineer in Philadelphia, PA.

There are several ways to get in touch with me:

Feel free to reach out to me if you have any comments, suggestions, or bug reports.

diceware's People

Contributors

atoponce avatar dependabot[bot] avatar dmuth avatar ericdrgn avatar sosaymon avatar weltraumschaf 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

diceware's Issues

Question

What license is it under?
Can I modify it ?
I will definitely credit you for your hard work but I would love to change the design, remove some of the text and stuff like that.

Reduce or eliminate dice animation?

Great tool! Thank you for sharing it with the world!

I'd love to see the dice animation time reduced or eliminated entirely because it is (presumably) cosmetic and makes it cumbersome to generate numerous passwords quickly.

I often pick-over several rolls before I find a series of words that I like; I wait until I find words that are memorable for me and don't necessarily just accept the first roll, and I assume others interact with these types of generators similarly.

If a PR is welcome, I'm happy to take a look at the source and see if I can implement the change.

Thanks!

Update information for Python3

The Python3 equivalent of python -m SimpleHTTPServer is python -m http.server, which considering most people should be using right now would be important to modify in the readme - source.

Convert Unit Tests from QUnit to Mocha

It turns out that QUnit doesn't play nice with webpack. I learned this the hard way while fixing #7.

And that's a shame, because I liked QUnit.

That said, I need to port over QUnit tests to Mocha and deprecate QUnit.

7,776 possible words per dice roll

It was pointed out to me that with only 7,776 words per dice roll (https://twitter.com/shazow/status/819991188388323329), even though we have a decent amount of randomness, there are only 7,776 possibilities which may be a concern. As such, I should consider a greater number of dice rolls per word. Here are my options

6 dice per word: 46,656 words
7 dice per word: 279,936 words
8 dice per word: 1,679,616 words

This is easy enough to write code for, but I need to figure out the following things:

  • Would a longer wordlist.js file cause problems in web browsers on both desktops and mobile phones?
  • Would there be UI issues related to the size of the dice, especially on mobile phones?

Suggestions are welcome! I'm going to wait a few days before starting on this one...

Option to include digits

An increasing number of websites require digits as fourth character class. It would be grand if diceware could either include digits in the set selectable with -s, or add another option like -s for digits.

Remove hypens from words

I received a note from Jonathan Joseph Chiarella pointing out that hyphens in words can cause all sorts of problems.

Specifically, we have yo-yo and yoyo in the word list, which can cause all sorts of confusion if repeating the password verbally.

Another thing that can be an issue is non-native speakers of English. Aside from not knowing the hyphenated versions of words, in some languages such as Japanese a dash character is used as an apostrophe.

So I need to go through the wordlist and remove any words that have hypens in them.

yoyo in EFF wordlist

I like the use of the EFF wordlist but it contains both yoyo (66631) and yo-yo (66622). Depending on only hyphenation to seperate entries seems like a bug (no other hyphenated entry in the EFF list is also present in non-hyphenated form).

Perhaps one of the yoyos can be substituted in your implementation?

Quality of Life Improvements

  • Add a QR Code which can be used to share the app from a mobile phone.
  • Add a mention of phishing attacks in the FAQ

Question: IS this repo different? A lotta variations! <3

website breaks if you spam click on generate password

Screenshot 2021-05-15 171018

you should disable the buttons while the password is being generated in order to prevent this from happening. Not only it generates a lot of text, it also prevents you from doing anything on website (frozen) and only way is to reload or close off and come back

Refactor Javascript In Preparation for Multiple Wordlists

There's been some talk about multiple word lists, and as part of the effort for this, I think I'm going to need to do a refactor of Javascript, as src/index.js is currently at 500 lines. So here's the stuff I want to get done in this branch:

  • Split up Diceware.go() into smaller functions
  • Put display_row() and rollDiceHandler*() functions into a separate file
  • Loading file code
    • I want to change this or it's just an AJAX/XHR load request
    • ...and the file should be a plain file
  • Upload Roll Dice! button to display that the wordlist is being loaded. This should prevent conditions where people click the button before the wordlist is loaded.
  • Add <NOSCRIPT> tags for the benefit of people using Tor or a similarly locked down browser

At the conclusion of this bug, I should be in a much better state to be able to start loading additional wordlists, if so desired. I'm specifically keeping #45 and #39 in mind here.

NOTE: One thing that hampers me is that I I don't do much front-end development professionally, so my knowledge of the Javascript ecosystem (like, webpack and friends) has stagnated. Any guidance for structuring my code better is certainly welcome. :-)

-- Doug

Localized words lists

Hi! My I suggest having localized words lists? There's a list online that could be a starting point.

If accepted, I could help, but I'm not the right person to check the quality of the lists.

Unintentional globals

A couple of for statements have for (i=... instead of for (var i=..., which will make that variable global. Definitely not what I want. (and what was thinking?)

bundle.js missing from /dist/ in repo

It seems that bundle.js is missing from the ./dist/ folder in the repo, which causes the software to be non-functional. Grabbing a copy from your website seems to instantly fix the problem. (My apologies if I'm missing something!)

PS: Thanks for the awesome software.

Increase number of dice per roll

This is a continuation of #2, that I am splitting off into its own issue.

For this issue, I'd like to investigate the following:

  • Generating Javascript files which contain arrays of 46,656 words (6 dice), 279,936 words (7 dice), and 1,679,616 words (8 dice). This will involve modifying the PHP code which generates taht Javascript.
  • Adding functionality into the Diceware Javascript that will allow me to specify how many dice rolls per word (and therefore, which wordlist file to load) so that I can...
  • Test the performance of Diceware on desktop and mobile platforms with the different wordlist sizes on both Wifi, LTE, and 3G networks.
  • Optionally create a modal of some kind that is displayed while the wordlist is loading.

Reduce number of files in root directory

Right now, the file listing takes up most of the front page, pushing down the README:

image

I'd like to fix that by moving some of those files into subdirectories.

Quality of Life Improvements

There are a couple of things that I'd like to do:

  • Shorten the dice rolling time. This will be helpful for rolling 8 dice.
  • Shorten the "number of possible passwords" value. I'll do this by turning numbers like "123,456,789,000" into "123 billion", for example.

Sans-serif font - readibility issues with lookalike characters

When a password is generated with "I", "l", "1", and other lookalike characters, it can be confusing to read with the current font choice, since it uses a sans-serif font.

This isn't as big of an issue with words as passwords, but it still causes some confusion when looking at the generated phrase. For example, if the phrase is "StillIllness" (StillIllness), a serif font would be better than a san-serif font to display the words and phrase generated.

Numbers and symbols

Despite the advice in your FAQ to not include numbers or symbols, some systems (such as Microsoft 365) require them. Is there a chance you could add an option for numbers and symbols to be added to the resulting password? Perhaps one between each of the words? Whatever would make it easier to remember, of course.

address space for 6 and 7

when a 6 dice are selected, it says # of possible passwords:
221,073,919,720,733,360,000,000 that indicates a word list of 7776 i believe.

But in the FAQ it states:
FAQ: Can you tell me more about the list of words? "Peter Norvig's (1/3 million) list is still in use for when 6 or 7 dice are rolled."

FAQ: How many dice are rolled per word?
"you can run Diceware with 6 dice per word and 7 dice per word (for 46,655 and 279,935 possible words, respectively),"

update faq to indicate the word list used by 6 and 7 as necessary to make it clear its using the 7776 word list.

thanks for an awesome project.

Modulo reduction introduces bias

retval = (a[0] % max);

This is sort of a common CSPRNG anti-pattern where byte strings are converted to integers. To prove the bias, consider the following mapping:

function demonstrateBias(max) {
  if (typeof max !== 'number') {
    throw("Invalid type");
  }
  var map = new Array(max);
  // Initialize the values at 0
  for (var i = 0; i < max; i++) {
    map[i] = 0;
  }

  for (var i = 0; i < 256; i++) {
    map[i % max]++;
  }
  return map;
}

And then if you run this:

demonstrateBias(3);
[86, 85, 85]
demonstrateBias(6);
[43, 43, 43, 43, 42, 42]

So what ends up happening is you get some values slightly more often, even given a secure random source, which can be used by attackers to have a higher probability of guessing your generated passphrase.

The solution implemented here has been reviewed by cryptographers and Node.js security experts and is available under WTFPL / CC0 if you'd like to adapt this library (or use it as a module).

Put wordlist into a Trie data structure

This is a continuation of #2, which I am splitting into two separate issues.

It was suggested in that issue that I store the words in a Trie, which would be more space efficient. While that seems straightforward, and I can figure out how to create the Trie, it's not 100% clear to me how I would do traversal in a manner that takes less space than the words themselves, assuming each node in the Trie holds 1 character.

I may need to go do some Google searches for how PKzip worked, as it uses a Trie to compress text, IIRC.

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.