<commit_before>/******************************************************************************
   Password strength analyzer

   Use analyze(text) to analyze and get a score of how strong, or
   unguessable, the password or passphrase is. A zero-length input
   will yield a score of 0, which is the worst, and the higher the
   score the stronger the password. In addition a word is also
   attributed including a color.

   It uses two metrics to calculate a score: Basic16 and Comprehensive8
   The one producing the largest score is the result.

   Basic16 yields 4 points for each of the first 7 characters after
   which 8 points are awarded subsequent characters. A score of 100 is
   awarded 16 characters, which is why it's called Basic16.

   Comprehensive8 yields 4 points for each character and an additional
   17 points for each uppercase character, digit or symbol. Inputting
   a second unique uppercase character, digit or symbol yields an
   additional 8 points, and a third adds extra 4 points. If no
   lowercse characters are found then 17 points are deducted, and if
   the text does not appear in the word list then 17 points are added.

   The word lists used were provided by Open Wall:
     http://download.openwall.net/pub/wordlists/passwords/

   Deps: jQuery, XRegExp
 ******************************************************************************/
"use strict";
function Psw(path) {
  this.loadPath = path || "wordlist.json";
  this.wordlist = [];
  this.wordObject = {};
  var self = this;

  if (localStorage["wordlist"] != null) {
     self.wordObject = JSON.parse(localStorage["wordlist"]);
     self.wordlist = self.wordObject.wordlist;
     console.log("Loaded wordlist from local storage!");
  } else {
     $.ajax({
       "type" : "GET", 
       "url" : self.loadPath,
       "success" : function(data, status, xhr) {
          console.log("Loaded wordlist from \"" + self.loadPath + "\"");
          localStorage["wordlist"] = JSON.stringify(data);
          self.wordObject = JSON.parse(localStorage["wordlist"]);
          self.wordlist = self.wordObject.wordlist;
         }, 
       "error" : function(xhr, status, error) {
          console.log("Error" + error);
       }
    });
 }
}
window["Psw"] = Psw;

Psw.prototype.analyze = function(text) {
  var score = this.calcScore(text);
  var meaning = this.scoreMeaning(score);<commit_msg>fix for build in PHP web server<commit_after>/******************************************************************************
   Password strength analyzer

   Use analyze(text) to analyze and get a score of how strong, or
   unguessable, the password or passphrase is. A zero-length input
   will yield a score of 0, which is the worst, and the higher the
   score the stronger the password. In addition a word is also
   attributed including a color.

   It uses two metrics to calculate a score: Basic16 and Comprehensive8
   The one producing the largest score is the result.

   Basic16 yields 4 points for each of the first 7 characters after
   which 8 points are awarded subsequent characters. A score of 100 is
   awarded 16 characters, which is why it's called Basic16.

   Comprehensive8 yields 4 points for each character and an additional
   17 points for each uppercase character, digit or symbol. Inputting
   a second unique uppercase character, digit or symbol yields an
   additional 8 points, and a third adds extra 4 points. If no
   lowercse characters are found then 17 points are deducted, and if
   the text does not appear in the word list then 17 points are added.

   The word lists used were provided by Open Wall:
     http://download.openwall.net/pub/wordlists/passwords/

   Deps: jQuery, XRegExp
 ******************************************************************************/
"use strict";
function Psw(path) {
  this.loadPath = path || "wordlist.json";
  this.wordlist = [];
  this.wordObject = {};
  var self = this;

  if (localStorage["wordlist"] != null) {
     self.wordObject = JSON.parse(localStorage["wordlist"]);
     self.wordlist = self.wordObject.wordlist;
     console.log("Loaded wordlist from local storage!");
  } else {
     $.ajax({
       "type" : "GET", 
       "url" : self.loadPath,
       "success" : function(data, status, xhr) {
          console.log("Loaded wordlist from \"" + self.loadPath + "\"");
          if (typeof data === "string") {
            var data = JSON.parse(data);
          }
          localStorage["wordlist"] = JSON.stringify(data);
          self.wordObject = JSON.parse(localStorage["wordlist"]);
          self.wordlist = self.wordObject.wordlist;
         }, 
       "error" : function(xhr, status, error) {
          console.log("Error" + error);
       }
    });
 }
}
window["Psw"] = Psw;

Psw.prototype.analyze = function(text) {
  var score = this.calcScore(text);
  var meaning = this.scoreMeaning(score);
{'fraction_non_alphanumeric': 0.15132253434488416, 'fraction_numerical': 0.010662292392864465, 'mean_word_length': 3.312997347480106, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2162257', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1277, 'n_words': 506}