The console gives the below error :
brute.cpp: In function 'void createThreads(int, int, MAP&, std::string)': ../brute.cpp:125:67: error: no matching function for call to 'std::thread::thread(, std::reference_wrapperstd::unordered_map<std::basic_string<char, std::basic_string > >, std::string&)' 125 | threadVec.push_back(std::thread(remove, std::ref(bufObj), hash));
/***************** Method to check if the current buffer has a match of the given hash ***********?
void remove(MAP &buffer, std::string hash) {
while (buffer.size() > 0)
{
const auto itrHash = buffer.find(hash);
if (itrHash == buffer.end()) {
buffer.erase(itrHash, buffer.end());
}
else {
std::cout.flush();
std::cout << "\t*********\n\t SUCCESS :: The Password of the Hash to Check is " << itrHash->first << " is " << itrHash->second;
cracked = true;
}
}
return;
}
/***** Method to accumulate a hash and the respective string value to a unordered set of <string, string>
***********************/
void accumulate_hash(MAP &buffer, int beginIndex, int endIndex, int wordLen){
while (beginIndex < endIndex) {
std::cout << charList[beginIndex] <<'\n';
std::string prefix(1,charList[beginIndex]);
std::cout << prefix << '\n';
printAllKLengthRec(charList, prefix, sizeofArr, wordLen - 1, buffer);
beginIndex++;
}
}
/*@brief The method that equally divides the work between threads
* @params wordLen The length of the word
* @params threadCount Based on number of Cores
* @buffObj That stores all the hashs and the respective values
* @&threads Reference to list of Threads
**/
void createThreads(int wordLen, int threadCount, MAP &bufObj, std::string hash) {
int index = 0;
int charListSize = std::strlen(charList);
int charSetSize = charListSize / threadCount;
int difference = charListSize % threadCount;
int equallydividedWork = charSetSize;
std::vector<std::thread> threadVec;
std::cout<< hash << '\n\n';
/*******************Below Line is where the error is generated ********************?
threadVec.push_back(std::thread(remove, std::ref(bufObj), hash));
/*********************** ---------------------------------- **********************/
// The character list is divided into equal set of characters
// Each character Set is then used to generate strings that creates hashes
int i = 0;
while (index < charListSize) {
if (charSetSize == 0)
charSetSize = 1;
if(i + 1 == threadCount)
charSetSize += difference;
/***************Compiler Does not have issue with the below line though *********************/
// Threads are created
threadVec.push_back(std::thread(accumulate_hash, std::ref(bufObj), index, charSetSize, wordLen));
/********************* ---------------------------------------------------**********/
index = charSetSize;
charSetSize = charSetSize + equallydividedWork;
if (charSetSize >= charListSize) {
charSetSize = charListSize;
}
i++;
}
return;
}
Aucun commentaire:
Enregistrer un commentaire