所在位置:ToolsOh/生活工具/密码生成器or密码生成器
主要技术:java、zxcvbn
1、功能简介
使用zxcvbn对密码强度进行估算
2、输入、输出略
3、程序(算法)说明maven代码
com.nulab-inc zxcvbn1.5.2
java代码
import com.google.common.base.Joiner; import com.nulabinc.zxcvbn.Strength; import com.nulabinc.zxcvbn.Zxcvbn; import org.passay.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.validation.ConstraintValidatorContext; import java.util.Arrays; import java.util.Locale; @Component public class PasswordStrengthValidatorHelper { private static final Logger logger = LoggerFactory.getLogger(PasswordStrengthValidatorHelper.class); public Strength passwordStrength(String password) { Zxcvbn zxcvbn = new Zxcvbn(); Strength strength = zxcvbn.measure(password); logger.info(strength.getGuesses() + " n "+ strength.getCalcTime()+" n "+ strength.getScore()+" n "+ strength.getPassword()+" n "+ strength.getFeedback().getSuggestions(Locale.CHINESE)+" n "+ strength.getCrackTimesDisplay()); return strength; } public static void main(String[] args) { //System.out.println(new PasswordStrengthValidatorHelper().isPasswordValid("51IZZ@6JWVE")); System.out.println(new PasswordStrengthValidatorHelper().passwordStrength("111")); } }
测试结果
37.0 91298600 0 111 [再多加几个字符,不要添加常见字符。, 避免重复的单词和字符。] com.nulabinc.zxcvbn.AttackTimes$CrackTimesDisplay@6ea6d14e com.nulabinc.zxcvbn.Strength@ea4a92b4、关键业务流程
略
❑用户界面 1、成品演示
http://www.toolsoh.com/p/t/life/mimashengchengqi-passwordgenerator.html
2、界面展示❑致谢开源
- 开源项目作者: nulab
- 开源项目名称: zxcvbn4j
- 开源项目地址: https://github.com/nulab/zxcvbn4j 去star
- 开源项目描述: 这是zxcvbn的一个java端口,是一个Javascript密码强度生成器。This is a java port of zxcvbn, which is a Javascript password strength generator.
❑END
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)