<commit_before>package com.xkcd.n936.lib;

/**
 * Calculate strength stats for an EasyPassword
 * @author alok
 *
 */
public class EasyPasswordStats {

	/**
	 * 
	 * @return length of equivalent hex string given current num words and dict size.
	 * 
	 */
	public static double calcHexLen(EasyPassword pass) {
		double hexBitsPerChar = 4;// Math.log(16)/Math.log(2)
		return calcBits(pass)/hexBitsPerChar;
	}
	
	public static double calcAlphaNumLen(EasyPassword pass) {
		return calcLen(pass,26 // letters 
				+ 10 // digits 
				);
	}
	public static double calcRandLen(EasyPassword pass) {
		return calcLen(pass, 26 // letters 
				+ 10 // digits 
				+ 10 // !@#$%^&*()
				+ 5 //~`-=+_ 
				);
	}
	/**
	 * 
	 * @return length of equivalent string chosen from numSymbols given current num words and dict size.
	 * 
	 */
	public static double calcLen(EasyPassword pass, int numSymbols) {
		double bitsPerChar = Math.log(numSymbols)/Math.log(2);
		return calcBits(pass)/bitsPerChar;
	}

	/**
	 * 
	 * @return bit strength given current num words and dict size.
	 * 
	 */
	public static double calcBits(EasyPassword pass) {
		return (double)pass.getNumWords() * Math.log(pass.getDictSize())/Math.log(2);
	}
}
<commit_msg>fixed bug in stats calculation<commit_after>package com.xkcd.n936.lib;

/**
 * Calculate strength stats for an EasyPassword
 * @author alok
 *
 */
public class EasyPasswordStats {

	/**
	 * 
	 * @return length of equivalent hex string given current num words and dict size.
	 * 
	 */
	public static double calcHexLen(EasyPassword pass) {
		double hexBitsPerChar = 4;// Math.log(16)/Math.log(2)
		return calcBits(pass)/hexBitsPerChar;
	}
	
	public static double calcAlphaNumLen(EasyPassword pass) {
		return calcLen(pass,26 + 26 // letters 
				+ 10 // digits 
				);
	}
	public static double calcRandLen(EasyPassword pass) {
		return calcLen(pass, 26 + 26 // letters 
				+ 10 // digits 
				+ 10 // !@#$%^&*()
				+ 5 //~`-=+_ 
				);
	}
	/**
	 * 
	 * @return length of equivalent string chosen from numSymbols given current num words and dict size.
	 * 
	 */
	public static double calcLen(EasyPassword pass, int numSymbols) {
		double bitsPerChar = Math.log(numSymbols)/Math.log(2);
		return calcBits(pass)/bitsPerChar;
	}

	/**
	 * 
	 * @return bit strength given current num words and dict size.
	 * 
	 */
	public static double calcBits(EasyPassword pass) {
		return (double)pass.getNumWords() * Math.log(pass.getDictSize())/Math.log(2);
	}
}

{'fraction_non_alphanumeric': 0.12484799351438995, 'fraction_numerical': 0.01783542764491285, 'mean_word_length': 3.1901528013582343, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6637068', 'n_tokens_mistral': 933, 'n_tokens_neox': 788, 'n_words': 216}