Commit 3f4253b1 authored by Mathieu Valois's avatar Mathieu Valois
Browse files

replace double by uint64_t

parent 92cf91d1
Loading
Loading
Loading
Loading
+8 −8
Changes for Statsgen/include/statsgen.h: 8 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -89,10 +89,10 @@ struct thread_data {
	double total_counter = 0;
	double total_filter = 0;

	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;
	std::unordered_map<int, uint64_t> length;
	std::unordered_map<std::wstring, uint64_t> simplemasks;
	std::unordered_map<std::wstring, uint64_t> advancedmasks;
	std::unordered_map<std::wstring, uint64_t> charactersets;
	std::queue<std::wstring> password_queue;

	minMax minMaxValue;
@@ -220,10 +220,10 @@ private:

	// Dictionary

	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
	std::unordered_map<int, uint64_t> stats_length;					// Passwords' length linked to their occurrence
	std::unordered_map<std::wstring, uint64_t> stats_simplemasks;	// Passwords' simple mask linked to their occurrence
	std::unordered_map<std::wstring, uint64_t> stats_advancedmasks;	// Passwords' advanced mask linked to their occurrence
	std::unordered_map<std::wstring, uint64_t> stats_charactersets;	// Passwords' characterset linked to their occurrence


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

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

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

+1 −1
Changes for Statsgen/src/statsgen.cpp: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -296,7 +296,7 @@ void Statsgen::print_stats() {
	if (outfile_name != ""){
		locale::global(locale("C"));
		wofstream outfile_stream(outfile_name);
		multimap<double, wstring> reverse = flip_map<wstring>(stats_advancedmasks);
		multimap<uint64_t, wstring> reverse = flip_map<wstring>(stats_advancedmasks);
		for(auto it=reverse.end();it!=reverse.begin();it--){
			if (it == reverse.end()) continue;
			if(it->second == L"othermasks") continue;