javascript - 使用 Dropbox 的 zxcvbn 密码强度估计器

标签 javascript jquery dropbox

我正在尝试获取 zxcvbn, Dropbox's password strength estimator ,正常工作...但我遇到了一些问题!

我已经包含了异步加载器。

我的下一个问题是我对 JS 的了解不够,无法弄清楚如何实际使用这个东西....

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

它是否用作该领域的某种监视器?

感谢您的帮助,我还在学习 JS/jQuery...

最佳答案

<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.
    */
});

为你摆弄,http://jsfiddle.net/MhZ4p/

将遍历函数替换为破解时间

traverse(result);

到:

$('#result').html("cracktime : " + result.crack_time);

关于javascript - 使用 Dropbox 的 zxcvbn 密码强度估计器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11596556/

相关文章:

javascript - 循环遍历数组并查找重复数字

javascript - 为什么这个 AJAX 表单没有提交?

android - 在 Android 应用程序中集成 Dropbox,但没有登录弹出窗口

javascript - MeteorJS 和 Coffeescript

javascript - 如何设置 cookie 并基于 cookie 是否存在跳过登录屏幕?

javascript - 从字符串中获取CSS属性

javascript - 输入数字时的货币掩码和格式

javascript - writeFile 方法在 IE8 中有效吗?

javascript - 仅在 Dropbox 中存储文件时,Datastore 和核心 API 之间的区别?

javascript - 如何将项目附加到 Observable