Parallel brute force: Difference between revisions

m
Minor edit to C++ code
m (Minor edit to C++ code)
Line 279:
#include <string>
#include <vector>
 
#include <openssl/sha.h>
 
Line 287 ⟶ 288:
}
bool parse(const std::string& hash) {
if (hash.length() != 2 * SHA256_DIGEST_LENGTH) {
std::cerr << "Invalid SHA-256 hash\n";
return false;
Line 325 ⟶ 326:
password_finder(int);
void find_passwords(const std::vector<std::string>&);
 
private:
int length;
Line 345 ⟶ 347:
--count;
std::ostringstream out;
out << "password: " << passwd << ", hash: " << hashes[m] << '\n';
<< '\n';
std::cout << out.str();
break;
Line 367 ⟶ 370:
for (int i = 0; i < n; ++i) {
char c = 'a' + i;
futures.push_back(std::async(std::launch::async,
std::async(std::launch::async, [&this, c]() { find_passwords(c); }));
}
}
1,777

edits