最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using Dropbox's zxcvbn password strength estimator - Stack Overflow

programmeradmin1浏览0评论

I'm trying to get zxcvbn, Dropbox's password strength estimator, to work right... but I'm having some issues!

I've included the asynchronous loader.

My next problem is that I don't know enough JS to figure out how to actually use this thing....

<input id="password" name="password" size="35" class="textInput required" type="password">

is it used as some kind of monitor on that field?

Thanks for the help, I'm still learning JS/jQuery...

I'm trying to get zxcvbn, Dropbox's password strength estimator, to work right... but I'm having some issues!

I've included the asynchronous loader.

My next problem is that I don't know enough JS to figure out how to actually use this thing....

<input id="password" name="password" size="35" class="textInput required" type="password">

is it used as some kind of monitor on that field?

Thanks for the help, I'm still learning JS/jQuery...

Share Improve this question edited Jul 21, 2012 at 23:31 Ryan 14.6k8 gold badges67 silver badges104 bronze badges asked Jul 21, 2012 at 23:13 ShackrockShackrock 4,70110 gold badges50 silver badges74 bronze badges 2
  • Since you're new to JS, it might be easiest to find a jQuery password meter plugin, and then just configure that plugin to use the global function that zxcvbn creates. – Lèse majesté Commented Jul 21, 2012 at 23:40
  • +1 for the wonderful password strength checker, liked it :) – sabithpocker Commented Jul 21, 2012 at 23:49
Add a comment  | 

1 Answer 1

Reset to default 21
<input id="password" name="password" size="35" class="textInput required" type="password"/>
<div id="result">
Laaa laa laa...
</div>

$('#password').keyup(function() {
  var textValue = $(this).val();
  var result = zxcvbn(textValue);
  $('#result').html("cracktime : " + result.crack_time);
  //use this result as you like
    /*
    result.entropy            # bits

result.crack_time         # estimation of actual crack time, in seconds.

result.crack_time_display # same crack time, as a friendlier string:
                          # "instant", "6 minutes", "centuries", etc.

result.score              # [0,1,2,3,4] if crack time is less than
                          # [10**2, 10**4, 10**6, 10**8, Infinity].
                          # (useful for implementing a strength bar.)

result.match_sequence     # the list of patterns that zxcvbn based the
                          # entropy calculation on.

result.calculation_time   # how long it took to calculate an answer,
                          # in milliseconds. usually only a few ms.
    */
});

Fiddle for you, http://jsfiddle.net/MhZ4p/

replace the traverse function for just crack time

traverse(result);

to:

$('#result').html("cracktime : " + result.crack_time);
发布评论

评论列表(0)

  1. 暂无评论