server icon indicating copy to clipboard operation
server copied to clipboard

Implementing password strength check

Open ngn13 opened this issue 2 years ago • 4 comments

I removed:

minLength: number;
minNumbers: number;
minUpperCase: number
minSymbols: number

and instead implemented

strength: number;

~~Also I removed the shannon entropy calculation, I couldn't get it to work and idk math~~ entropy calculation now works thanks to @greysilly7

ngn13 avatar Jun 14 '23 16:06 ngn13

I am against this PR the entropy calculation has an information theoretical basis here, and it checks how much information that the password carries relative to an incompressible string (which is what we want an ideal password to be, not an unrememberable string of special characters)

I made a mistake with my wording, I didn't exactly remove it. See the "Files changed".

function calculateEntropy(str: string) {
	// TODO: calculate the shannon entropy
	return 0;
}

ngn13 avatar Jun 14 '23 18:06 ngn13

@ngn13 Your change makes the entropy calculation always return zero, which is not the desired behaviour here.

erkinalp avatar Dec 26 '23 12:12 erkinalp

I understand that, the previous implementation did not work properly (and idk how to fix it), so I commented it out and left a to-do note so someone who knows math can implement it later.

ngn13 avatar Dec 26 '23 19:12 ngn13

This will most likely work https://github.com/ngn13/server/pull/1 I don't have the environment to test it right now

greysilly7 avatar Jan 01 '24 07:01 greysilly7