2018-04-25 12:34:11 +02:00
|
|
|
//============================================================================
|
|
|
|
// Name : bfclient.cpp
|
|
|
|
// Author : Armin Friedl
|
|
|
|
// Version :
|
|
|
|
// Copyright : Public Domain
|
|
|
|
// Description : Hello World in C++, Ansi-style
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include <bytestr.h>
|
|
|
|
#include <ec_pubkey_fast.h>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <iostream>
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
#include "bf/Brainflyer.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#define BATCH_MAX 4096
|
2018-04-25 23:37:19 +02:00
|
|
|
#define WIN_SIZE 21
|
2018-04-25 12:34:11 +02:00
|
|
|
|
|
|
|
int main() {
|
2018-04-25 23:37:19 +02:00
|
|
|
util::bytestr key("db53d9bbd1f3a83b094eeca7dd970bd85b492fa2");
|
2018-04-25 12:34:11 +02:00
|
|
|
|
|
|
|
cout << "Initializing precomputation table" << endl;
|
|
|
|
// init with window size 16, not reading from file
|
|
|
|
if (secp256k1_ec_pubkey_precomp_table(WIN_SIZE, nullptr) != 0) {
|
|
|
|
cout << "Initialization of precomputation table failed" << endl;
|
|
|
|
return (EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "Initializing threads" << endl;
|
|
|
|
unsigned int numThreads = thread::hardware_concurrency();
|
|
|
|
cout << numThreads << " hardware threads available" << endl;
|
|
|
|
thread* threads = new thread[numThreads];
|
|
|
|
cout << "Starting " << numThreads << " threads" << endl;
|
|
|
|
|
2018-04-27 23:38:52 +02:00
|
|
|
//numThreads = 1;
|
2018-04-25 12:34:11 +02:00
|
|
|
for (unsigned int i = 0; i < numThreads; i++) {
|
|
|
|
threads[i] = thread{bf::Brainflyer(i, "127.0.0.1", 26765, key)};
|
|
|
|
}
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < numThreads; i++) threads[i].join();
|
|
|
|
|
|
|
|
delete[] threads;
|
|
|
|
|
|
|
|
return (EXIT_SUCCESS);
|
|
|
|
}
|