密码强度估算JavaScript库:zxcvbn
jopen
10年前
zxcvbn是一个JavaScript密码强度估算库。用它来实现一个注册表单的自定义密码强度条。由dropbox 开发。它需要一个必需的参数,输入密码,然后返回一个结果对象。结果包括一些属性:
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.