Algorithm to calculate password strength | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Algorithm to calculate password strength

Hi everyone! I'm currently working on the Password Generator challenge, but I have absolutely no idea how to calculate the password strength. Any hints highly appreciated. Maybe the strength could be calculated as a factorial of brute-force trials that are needed to hack the password. But then again, how could this be done? I'm lost here, could someone help me out? Thanks

10th Feb 2019, 8:31 PM
Pete Wright
Pete Wright - avatar
7 Answers
11th Feb 2019, 3:13 AM
Lambda_Driver
Lambda_Driver - avatar
+ 1
Two factors determine a password's strength: length and complexity. A password's length is determined by the number of characters in the password. ... When you combine letters, numbers, and symbols in a password you increase the password's complexity. A higher complexity yields a higher password strength. good Passwords need to meet the following requirements: MUST contain at least 8 characters (12+ recommended) MUST contain at least one uppercase letter. MUST contain at least one lowercase letter. MUST contain at least one number. MUST contain at least one special character (!”#$%&'()*+,-./:;<=>?@[\]^_`{ can force users to obey rules that make passwords strong
10th Feb 2019, 8:44 PM
peter
peter - avatar
+ 1
ohh that might be one those questions one regrets later, try read this, will be many acrticles online about the formulas used http://cubicspot.blogspot.com/2011/11/how-to-calculate-password-strength.html?m=1
10th Feb 2019, 9:36 PM
peter
peter - avatar
+ 1
sorry no quick fix i know of maybe one the mods will chip in with something
10th Feb 2019, 10:49 PM
peter
peter - avatar
+ 1
having re read what you posted something else came to mind. permutations u can only have so many in any given inputs. read this maybe https://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms/1506337#1506337 maybe that type of approach can generate all permutations possible , bit like Turing the rest spent so long looking for the corrert answers, he found it was easier to remove the wrong leaving the correct
10th Feb 2019, 11:57 PM
peter
peter - avatar
0
Okay, but my Password Generator already applies all the requirements and only generates passwords that match these requirements. https://code.sololearn.com/W8173LtaRbjX/?ref=app Do you have an idea how to calculate the 'complexity' of a password?
10th Feb 2019, 9:21 PM
Pete Wright
Pete Wright - avatar
0
Thanks Peter, I've read the whole three part thing and had a peek at the git page. Whoa! That's some big heap of code over there. Till now I couldn't find any algorithm for password strength calculation. Could be somewhere in one of the files. Do you have a quick'n'dirty solution? Edit: I am currently working on a brute-force function, that loops through a string with all possible characters to find the password. The problem is: I'm stuck at the loops... What I'm trying to achieve is to generate a list of all possible outputs, something like this: a b c ... z A B C ... Z 0 1 2 3 ... 9 aa ab ac ... az aA aB aC ... aZ a0 a1 a2 a3 ... a9 ba bb bc ... bz bA bB bC ... bZ b0 b1 b2 b3 ... b9 ... and then try special characters ... I think you get the point.
10th Feb 2019, 10:15 PM
Pete Wright
Pete Wright - avatar