Iv created an array list which contains people and attributes such as user id, username etc. It works fine for the most part. It allows the user to enter a name into the system. If the name entered matches a name stored in the array list then it will display that user, its id, name and password. I need to implement a password strength checker; but i am struggling.
First off; i need a method that will determine how strong a password is. I then need to find a means of how to output the result of this, outputting it alongside the other outputted attributes: id, name and password.
I have of course attempted this, however being fairly new to Java my attempt did not go too well. I understand basic programming concepts; however when it comes to implementing ideas with code and syntax; my ideas fall flat.
Here is what i have attempted so far, but to be honest its probably completely different to the exact strength check and way that i want the result to be displayed. Iv shown my code below. But please, anybody; im asking if you could offer me the solution that i am looking for. I know that the code below is a good start, but its not close to implementing the code in a way that the password strength result can be outputted in the arraylist after a search for a user and their password is made.
private int checkPasswordStrength2(String passw) { int strengthCount=0; String[] partialRegexChecks = { ".*[a-z]+.*", // lower ".*[A-Z]+.*", // upper ".*[\\d]+.*", // digits ".*[@#$%]+.*" // symbols }; if (passw.matches(partialRegexChecks[0])) { strengthCount+=1; } if (passw.matches(partialRegexChecks[1])) { strengthCount+=1; } if (passw.matches(partialRegexChecks[2])) { strengthCount+=1; } if (passw.matches(partialRegexChecks[3])) { strengthCount+=1; } if (strengthCount==1) { System.out.println("Password is weak"); } if (strengthCount==2) { System.out.println("Password is meduim"); } if (strengthCount==3) { System.out.println("Password is good"); } if (strengthCount==4) { System.out.println("Password is very good"); } return strengthCount; }
Iv been at it for hours now, and i mean hours. I just really want to get this done. Iv looked for solutions online; but they implement a password strength checker much differently to how mine needs to work from what i can tell.