Jay1b Posted March 10, 2006 Posted March 10, 2006 Could someone please enlighten me on what the best way to check password strength is? The password in question must be at least 8 characters including at least 1 numeric and 1 non-alpha-numeric character. I can compare the two passwords, but i dont know how to ensure each one is of a certain strength. Thanks. Quote
Cags Posted March 10, 2006 Posted March 10, 2006 You should be able to use a RegularExpression, I can't tell you exactly what one that as I don't know much about them. Quote Anybody looking for a graduate programmer (Midlands, England)?
Jay1b Posted March 10, 2006 Author Posted March 10, 2006 Yeah i was thinking that, but like yourself, i know nothing about them :( Quote
Leaders snarfblam Posted March 10, 2006 Leaders Posted March 10, 2006 You could skip the regular expressions and just do what seems to me to be the simplest thing: check for each quality that you want in a password. Check if it is 8 chars long, then check if it contains a number and a non-alphanumeric. Function ValidatePassword(ByVal Password As String) As Boolean If Password.Length < 8 Then Return False 'Too short Dim HasDigit As Boolean = False Dim HasNonAlphaNumeric As Boolean = False For Each c As Char In Password If Char.IsDigit(c) Then HasDigit = True If Not (Char.IsLetterOrDigit(c)) Then _ HasNonAlphaNumeric = True Next Return HasDigit And HasNonAlphaNumeric 'If it has both qualities, return true. 'If not, the password is not strong enough. End Function For a really "strong" password, you could check to make sure that the password is not only eight characters long and has the two special characters, but also that it does not consist of only one normal (i.e. found in a dictionary) word and the special characters. In other words, remove the number and non-alphanumeric character, and compare with a dictionary (or spell checker). If you get a match from a dictionary, or a correctly spelled word from a spell checker, you have a mid-range strength password. If not, you have a very strong password. Quote [sIGPIC]e[/sIGPIC]
kejpa Posted March 13, 2006 Posted March 13, 2006 There is a test at.... Swedish Post and Tele Direction (it's all in Swedish :() Might help you /Kejpa Quote
Jay1b Posted March 13, 2006 Author Posted March 13, 2006 Marble, thanks for that. I was going to originally code it like that, but i didnt know how to check for non-alpha-numeric characters. Kejpa...ermmm... thanks for that...lol... Unfortunately i dont speak Swedish :( Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.