EFForg / OpenWireless

The official home of the EFF OpenWireless Project
Other
732 stars 80 forks source link

Implement Diceware Passphrase Generator #195

Closed sarciszewski closed 10 years ago

sarciszewski commented 10 years ago

Note: This is a first swing. I do not have the hardware necessary to test it properly at the moment.

Fixes #163

jsha commented 10 years ago

This is awesome, thanks for putting it together so quickly! If you want to be able to test Web UI code without a physical router, you should be able to start up the Web UI locally with:

./local-lighttpd/run-local-lighttpd.sh

You might first need to run:

./install-dev-dependencies.sh
sarciszewski commented 10 years ago

Sure, give me a bit to set up my environment. I will post another comment (and possibly more commits) when this is tested.

Do you want me to rebase it all to flatten it into one commit when it's ready to merge?

sarciszewski commented 10 years ago

https://twitter.com/DefuseSec/status/493809824233058304

We should now be generating unbiased random numbers. :D

sarciszewski commented 10 years ago

Okay, now we're generating random passwords, with callbacks instead of timeouts, and using bitmasks to coerce the random value to be within our range more often.

jsha commented 10 years ago

Just tested this on Chromium / Linux and find that Math.log2 is not defined. Is there an alternative you can use?

sarciszewski commented 10 years ago

Well, we could polyfill it. :)

if (typeof Math.log2 === 'undefined') {
    Math.log2 = function(x) {
        return Math.log(x)/Math.log(2) 
    };
}
cooperq commented 10 years ago

You should be able to do this like so funciton log2(n){ return Math.log(n) / Math.log(2) } Based on the formula here: https://en.wikipedia.org/wiki/Common_logarithm#Numeric_value

On 07/28/2014 12:45 PM, jsha wrote:

Just tested this on Chromium / Linux and find that Math.log2 is not defined. Is there an alternative you can use?

— Reply to this email directly or view it on GitHub https://github.com/EFForg/OpenWireless/pull/195#issuecomment-50388690.

jsha commented 10 years ago

Okay, code all looks great now. One UX issue: when you visit the SSID page, the passphrase field is prefilled, which means you can't see the grey text that indicates it's a passphrase.

I've put some ideas about how I think the 'auto-generated passphrase' flow should work, at #79. For now, I'd like to get this branch merged but without the confusing UX. Could you temporarily remove the part that fills in the default value into the text field, and then I'll merge this branch? Then we can tackle the new UX in a separate branch.

sarciszewski commented 10 years ago

Sure thing. I moved it into its own function in case you want users to be able to shuffle through until they find one that is easier to memorize or something. :)