i need help making an apk with terminal output from this c++ script:
#include <iostream>
include <vector> include <string> include <thread> include <atomic> include <chrono> include <iomanip> include <cstring> include <sstream>// OpenSSL Header
include <openssl/obj\_mac.h> include <openssl/ec.h> include <openssl/sha.h> include <openssl/ripemd.h> include <openssl/rand.h>constexpr int BATCH_SIZE = 1000; constexpr int NUM_THREADS = 4;
// Ziel-Adresse definieren const std::string TARGET_ADDRESS = "18VmXvkF4cgLi35RtMiHHDpvMjUCyVpQ9x";
// Base58 Alphabet static const char* BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
std::string base58_encode(const std::vector<uint8\_t>& input) { size_t zero_bytes = 0; while (zero_bytes < input.size() && input[zero_bytes] == 0) { zero_bytes++; }
size\_t size = (input.size() - zero\_bytes) \* 138 / 100 + 1; std::vector<uint8\_t> buf(size, 0); for (size\_t i = zero\_bytes; i < input.size(); i++) { int carry = input\[i\]; for (int j = static\_cast<int>(size) - 1; j >= 0; j--) { carry += 256 \* buf\[j\]; buf\[j\] = carry % 58; carry /= 58; } } size\_t i = 0; while (i < size && buf\[i\] == 0) { i++; } std::string output; output.reserve(zero\_bytes + (size - i)); for (size\_t j = 0; j < zero\_bytes; j++) { output.push\_back('1'); } for (; i < size; i++) { output.push\_back(BASE58\_ALPHABET\[buf\[i\]\]); } return output; }
// Hilfsfunktion: Bytes in Hex-String konvertieren std::string bytes_to_hex(const uint8_t* data, size_t len) { std::stringstream ss; for (size_t i = 0; i < len; ++i) { ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(data[i]); } return ss.str(); }
// NEU: WIF-Konverter für Electrum (Komprimiertes Format) std::string private_key_to_wif_compressed(const uint8_t* priv_bytes) { std::vector<uint8\_t> payload; payload.reserve(34); payload.push_back(0x80); // Mainnet Prefix payload.insert(payload.end(), priv_bytes, priv_bytes + 32); payload.push_back(0x01); // Compressed Flag
uint8\_t check1\[SHA256\_DIGEST\_LENGTH\]; uint8\_t check2\[SHA256\_DIGEST\_LENGTH\]; SHA256(payload.data(), payload.size(), check1); SHA256(check1, SHA256\_DIGEST\_LENGTH, check2); std::vector<uint8\_t> final\_bytes = payload; final\_bytes.insert(final\_bytes.end(), check2, check2 + 4); return base58\_encode(final\_bytes); }
std::string private_key_to_legacy(const uint8_t* priv_key) { // Bewusst belassener Overhead: Jedes Mal neue Allokation EC_KEY* key = EC_KEY_new_by_curve_name(NID_secp256k1); BIGNUM* bn = BN_bin2bn(priv_key, 32, nullptr); EC_KEY_set_private_key(key, bn);
const EC\_GROUP\* group = EC\_KEY\_get0\_group(key); EC\_POINT\* pub\_key = EC\_POINT\_new(group); EC\_POINT\_mul(group, pub\_key, bn, nullptr, nullptr, nullptr); EC\_KEY\_set\_public\_key(key, pub\_key); EC\_KEY\_set\_conv\_form(key, POINT\_CONVERSION\_COMPRESSED); uint8\_t pub\_bytes\[33\]; uint8\_t\* p = pub\_bytes; int pub\_len = i2o\_ECPublicKey(key, &p); uint8\_t sha256\_res\[SHA256\_DIGEST\_LENGTH\]; SHA256(pub\_bytes, pub\_len, sha256\_res); uint8\_t ripemd\_res\[RIPEMD160\_DIGEST\_LENGTH\]; RIPEMD160(sha256\_res, SHA256\_DIGEST\_LENGTH, ripemd\_res); uint8\_t payload\[21\]; payload\[0\] = 0x00; std::memcpy(payload + 1, ripemd\_res, RIPEMD160\_DIGEST\_LENGTH); uint8\_t check1\[SHA256\_DIGEST\_LENGTH\]; uint8\_t check2\[SHA256\_DIGEST\_LENGTH\]; SHA256(payload, 21, check1); SHA256(check1, SHA256\_DIGEST\_LENGTH, check2); std::vector<uint8\_t> final\_bytes(25); std::memcpy(final\_bytes.data(), payload, 21); std::memcpy(final\_bytes.data() + 21, check2, 4); EC\_POINT\_free(pub\_key); BN\_free(bn); EC\_KEY\_free(key); return base58\_encode(final\_bytes); }
std::atomic<uint64\_t> total_attempts{0};
// Eigenständiger Thread, der bei einem Treffer ununterbrochen alle 1s spammt void start_hit_spammer(std::string hex_key, std::string wif_key, std::string address) { std::thread([hex_key, wif_key, address]() { while (true) { std::cout << "\n==================================================\n" << "!!! TREFFER GEFUNDEN !!!\n" << "Ziel-Adresse: " << address << "\n" << "Private Key (Hex): " << hex_key << "\n" << "Electrum WIF Key: " << wif_key << "\n" << "==================================================\n" << std::endl; std::this_thread::sleep_for(std::chrono::seconds(1)); } }).detach(); }
void worker_thread() { uint8_t priv_key[32];
while (true) { for (int i = 0; i < BATCH\_SIZE; i++) { // Bewusst belassener Overhead: RAND\_bytes Lock-Contention RAND\_bytes(priv\_key, 32); std::string address = private\_key\_to\_legacy(priv\_key); // Prüfen, ob die generierte Adresse der Zieladresse entspricht if (address == TARGET\_ADDRESS) { std::string hex\_key = bytes\_to\_hex(priv\_key, 32); std::string wif\_key = private\_key\_to\_wif\_compressed(priv\_key); start\_hit\_spammer(hex\_key, wif\_key, address); } } total\_attempts.fetch\_add(BATCH\_SIZE, std::memory\_order\_relaxed); } }
int main() { std::cout << "==================================================\n"; std::cout << "C++ Benchmark - Bitcoin Key Bruteforce\n"; std::cout << "Ziel-Adresse: " << TARGET_ADDRESS << "\n"; std::cout << "Status: Bereit (inkl. Electrum WIF-Konverter)\n"; std::cout << "==================================================\n\n";
std::vector<std::thread> threads; for (int i = 0; i < NUM\_THREADS; i++) { threads.emplace\_back(worker\_thread); } auto start\_time = std::chrono::steady\_clock::now(); while (true) { std::this\_thread::sleep\_for(std::chrono::seconds(2)); auto current\_time = std::chrono::steady\_clock::now(); std::chrono::duration<double> elapsed = current\_time - start\_time; uint64\_t current\_attempts = total\_attempts.load(std::memory\_order\_relaxed); if (elapsed.count() > 0) { double speed = static\_cast<double>(current\_attempts) / elapsed.count(); std::cout << "\[" << current\_attempts << " Keys gesamt\] | Geschw.: " << std::fixed << std::setprecision(1) << speed << " Keys/s\\n"; } } for (auto& t : threads) { if (t.joinable()) t.join(); } return 0; }
submitted by /u/Least-Sprinkles3713[link] [comments]