Using Dropbox's zxcvbn password strength estimator

后端 未结 1 1698
迷失自我
迷失自我 2021-02-04 16:15

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

1条回答
  •  感动是毒
    2021-02-04 16:42

    
    
    Laaa laa laa...

    $('#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 讨论(0)
提交回复
热议问题