[wp-hackers] On overly-obscure passwords
Rafael Poveda - RaveN
raven at mecus.es
Wed May 12 18:03:55 UTC 2010
I was thinking about how it works, not using as external service. My mistake, sorry.
Problem solved :) (Good one!)
El 12/05/2010, a las 19:52, Otto escribió:
> On Wed, May 12, 2010 at 12:16 PM, Rafael Poveda - RaveN <raven at mecus.es> wrote:
>> We can use something like http://www.freepasswordgenerator.com/
>
> Why go nuts and use somebody's service when it's so easy to stick one
> in there via javascript? Making psuedorandom numbers ain't hard.
>
> demo.html
> ----
> <script type="text/javascript">
> function generatePassword(length) {
> var password = "";
> for (i=0; i < length; i++) {
> num = (parseInt(Math.random() * 1000) % 94) + 33;
> while (checkPunc(num)) { num = (parseInt(Math.random() * 1000)
> % 94) + 33; }
> password = password + String.fromCharCode(num);
> }
> return password;
> }
>
> function checkPunc(num) {
> if ((num >=33) && (num <=47)) { return true; }
> if ((num >=58) && (num <=64)) { return true; }
> if ((num >=91) && (num <=96)) { return true; }
> if ((num >=123) && (num <=126)) { return true; }
> return false;
> }
> </script>
>
> <h2>Demo JavaScript Password Generator</h2>
>
> <form name="form1">
> <p>Generated Password:<br />
> <input type="text" name="passfield" value="" size="15"><br />
> <input type="button" value="Generate Password"
> onClick="document.form1.passfield.value = generatePassword(12)"></p>
> </form>
> ----
>
>
>
> -Otto
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
Rafael Poveda <RaveN> | Mecus.es
raven at mecus.es | raven at raven.es
gtalk: rafael.poveda
More information about the wp-hackers
mailing list