Commit 7e3e4da2 authored by Jorand Jean-baptiste's avatar Jorand Jean-baptiste
Browse files
parents f030f7bc 942861f8
Loading
Loading
Loading
Loading
+8 −8
Changes for AdaptationParallel/include/statsgen.h: 8 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -77,10 +77,10 @@ struct thread_data {
	double total_counter = 0;
	double total_filter = 0;

	std::unordered_map<int, int> length;
	std::unordered_map<std::wstring, int> simplemasks;
	std::unordered_map<std::wstring, int> advancedmasks;
	std::unordered_map<std::wstring, int> charactersets;
	std::unordered_map<int, double> length;
	std::unordered_map<std::wstring, double> simplemasks;
	std::unordered_map<std::wstring, double> advancedmasks;
	std::unordered_map<std::wstring, double> charactersets;

	minMax minMaxValue;

@@ -199,10 +199,10 @@ private:

	// Dictionary

	std::unordered_map<int, int> stats_length;					// Passwords' length linked to their occurrence
	std::unordered_map<std::wstring, int> stats_simplemasks;	// Passwords' simple mask linked to their occurrence
	std::unordered_map<std::wstring, int> stats_advancedmasks;	// Passwords' advanced mask linked to their occurrence
	std::unordered_map<std::wstring, int> stats_charactersets;	// Passwords' characterset linked to their occurrence
	std::unordered_map<int, double> stats_length;					// Passwords' length linked to their occurrence
	std::unordered_map<std::wstring, double> stats_simplemasks;	// Passwords' simple mask linked to their occurrence
	std::unordered_map<std::wstring, double> stats_advancedmasks;	// Passwords' advanced mask linked to their occurrence
	std::unordered_map<std::wstring, double> stats_charactersets;	// Passwords' characterset linked to their occurrence


	// Counters
+8 −8
Changes for AdaptationParallel/include/utils.h: 8 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -29,11 +29,11 @@ using MapIterator = typename map<K, V>::const_iterator;
 * @return ordered map
 */
template<typename A> 
multimap<int, A> flip_map(const std::unordered_map<A, int> & src) {
    multimap<int, A> dst;
multimap<double, A> flip_map(const std::unordered_map<A, double> & src) {
    multimap<double, A> dst;

    for(UnorderedMapIterator<A, int> it = src.begin(); it != src.end(); ++it)
        dst.insert(std::pair<int, A>(it->second, it->first));
    for(UnorderedMapIterator<A, double> it = src.begin(); it != src.end(); ++it)
        dst.insert(std::pair<double, A>(it->second, it->first));

    return dst;
}
@@ -45,7 +45,7 @@ multimap<int, A> flip_map(const std::unordered_map<A, int> & src) {
 * @param 
 */
template<typename Type>
void readResult(int res, Type carac, int & count, const int & total_counter, const int & hiderare) {
void readResult(double res, Type carac, int & count, const double & total_counter, const int & hiderare) {
    float percentage;
    percentage = (float) (100*res) / total_counter;

@@ -71,11 +71,11 @@ void readResult(int res, Type carac, int & count, const int & total_counter, con
 * @param count : number of shown results
 */
template<typename Type>
void showMap(const unordered_map<Type, int> & stats, const int & top, const int & total_counter, const int & hiderare, int & count) {
void showMap(const unordered_map<Type, double> & stats, const int & top, const double & total_counter, const int & hiderare, int & count) {
	count = 0;
    multimap<int, Type> reverse = flip_map<Type>(stats);
    multimap<double, Type> reverse = flip_map<Type>(stats);
    
    MapIterator<int, Type> it;
    MapIterator<double, Type> it;
	for(it = reverse.end(); it != reverse.begin(); it--) {
        if (it == reverse.end()) continue;

+4
Changes for AdaptationParallel/src/statsgen.cpp: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -201,18 +201,22 @@ int Statsgen::generate_stats() {
		{
			stats_length[it->first]+=it->second;
		}
		td[i].length.clear();
		for(auto it=td[i].charactersets.begin();it!=td[i].charactersets.end();it++)
		{
			stats_charactersets[it->first]+=it->second;
		}
		td[i].charactersets.clear();
		for(auto it=td[i].simplemasks.begin();it!=td[i].simplemasks.end();it++)
		{
			stats_simplemasks[it->first]+=it->second;
		}
		td[i].simplemasks.clear();
		for(auto it=td[i].advancedmasks.begin();it!=td[i].advancedmasks.end();it++)
		{
			stats_advancedmasks[it->first]+=it->second;
		}
		td[i].advancedmasks.clear();
	}