The Score
class is used to calculate entropy scores of passwords. The entropy score is directly proportional to the strength of a password. The score can be calculated using a naive approach - mostly overestimating the strength of simple passwords - or using a more sophisticated approach - aiming to underestimate passwords such that users are encouraged to choose stronger passwords.
The class can easily be used to build a strength meter as for example Bootstrap Strength Meter.
new Score(password);
Parameters |
|
---|
This method is used to calculate a realistic entropy score of the password. This score can be used to reliably estimate the strength of a password.
score = new Score(password); score.calculateEntropyScore() score.calculateEntropyScore(options); score.calculateEnoptryScore(options, append);
Parameters |
|
---|---|
Returns | The method returns the calculated score which may range from zero to infinity. Check the demonstration to get a feeling for the calculated score. |
This method is used to calculate a naive entropy score, that is the password is not searched for patterns or dictionary entries.
score = new Score(password); score.calculateBruteForceEntropy();
Returns | The method returns the naive entropy score. |
---|
This method can be used to calculate the average number of seconds needed to crack a password with the given entropy score. The method assumes that it takes $0.005$ seconds to check a single password.
score = new Score(password); var entropy = score.calculateBruteForceEntropy(); score.calculateAverageTimeToCrack(entropy, cores);
Parameters |
|
---|---|
Returns | The method returns the number of seconds needed on average to crack the a password with the given entropy score. |
Running calculateEntropyScore
or calculateBruteForceEntropy
will cause Password Score to save some details in Score.cache
:
Score.cache.entropy | The entropy score calculated by calculateEntropyScore . |
---|---|
Score.cache.minimumMatches | The array of all patterns found by Password Score and corresponding to the calculated entropy score. |
Score.cache[key] |
// Remember the first dictionary of the default options: var options = [ { 'type': 'dictionary', 'leet': true, 'key': 'en', 'dictionary': {"you":1,"the":2,"to":3, /* see data/json/last.json ... */} }, ]; // ... score = new Score(password); score.calculateEntropyScore(); console.log(score.cache['en']); |
Score.cache.naiveEntropy | The entropy calculated by calculateBruteForceEntropy . |
Score.cache.clear | This method clears the cache. However, it is not necessary ot use this while not changing the configuration as all relevant information is overwritten when running calculateEntropyScore or calculateBruteForceEntropy repeatedly. |
The Keyboard
class is used to represent a specific keyboard layout as undirected graph. This class is mainly used by the Score
class to find keyboard patterns.
new Keyboard(adjacencyList, averageDegree);
Parameters |
|
---|
This method checks whether two key are adjacent in the keyboard.
keyboard = new Keyboard(adjacencyList, averageDegree); keyboard.areAdjacent(a, b);
Parameters |
|
---|---|
Returns | true if and only if the characters a and b are adjacent in the keyboard. |
© 2013 - 2018 David Stutz - BSD 3-Clause License - Impressum - Datenschutz