直播软件开发,随机密码生成器

直播软件开发,随机密码生成器

方法调用

 


public static void main(String[] args) {
        //排除字符0OoB81lI ,包含大写字母,包含小写字母,包含数字,包含特殊字符,长度8,生成10000个,特殊字符集
        generatePassword("0OoB81lI",true,true,true,true,8,10000,"~!@^*%");
    }

附带密码检测器

 

检测生成的密码是否合格

 


    private static  void  checkPasswordIsCorrect(){
        File file = new File("C:\\Users\\1002212\\Desktop\\445566.txt");
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new FileReader(file));
            String tempString ;
            int line = 1;
            // 一次读入一行,直到读入null为文件结束
            while ((tempString = reader.readLine()) != null) {
                // 显示行号
                if(!tempString.matches("^[0-9A-Za-z~!@^*#$%]{8}$")){
                    System.out.println("line " + line + ": " + tempString);
                }
                if(!tempString.matches(".*[0-9]+.*")
                        || !tempString.matches(".*[A-Z]+.*")
                        || !tempString.matches(".*[a-z]+.*")
                        || !tempString.matches(".*[~!@^*#$%]+.*")){
                    System.out.println("line " + line + ": " + tempString);
                }
                line++;
            }
            reader.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        }
    }

 

 以上就是 直播软件开发,随机密码生成器,更多内容欢迎关注之后的文章

 

posted @ 2023-09-25 14:04  云豹科技-苏凌霄  阅读(18)  评论(0编辑  收藏  举报