mirror of
https://github.com/xmrig/xmrig.git
synced 2024-10-30 21:17:52 +00:00
Added Cvt class.
This commit is contained in:
parent
469b1f08de
commit
63bd45c397
14 changed files with 355 additions and 341 deletions
|
@ -34,8 +34,8 @@
|
||||||
#include "base/io/Env.h"
|
#include "base/io/Env.h"
|
||||||
#include "base/io/json/Json.h"
|
#include "base/io/json/Json.h"
|
||||||
#include "base/kernel/Base.h"
|
#include "base/kernel/Base.h"
|
||||||
#include "base/tools/Buffer.h"
|
|
||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
|
#include "base/tools/Cvt.h"
|
||||||
#include "core/config/Config.h"
|
#include "core/config/Config.h"
|
||||||
#include "core/Controller.h"
|
#include "core/Controller.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
@ -222,13 +222,13 @@ void xmrig::Api::genId(const String &id)
|
||||||
const size_t inSize = (sizeof(APP_KIND) - 1) + addrSize + sizeof(uint16_t);
|
const size_t inSize = (sizeof(APP_KIND) - 1) + addrSize + sizeof(uint16_t);
|
||||||
const auto port = static_cast<uint16_t>(m_base->config()->http().port());
|
const auto port = static_cast<uint16_t>(m_base->config()->http().port());
|
||||||
|
|
||||||
auto*input = new uint8_t[inSize]();
|
auto *input = new uint8_t[inSize]();
|
||||||
memcpy(input, &port, sizeof(uint16_t));
|
memcpy(input, &port, sizeof(uint16_t));
|
||||||
memcpy(input + sizeof(uint16_t), interfaces[i].phys_addr, addrSize);
|
memcpy(input + sizeof(uint16_t), interfaces[i].phys_addr, addrSize);
|
||||||
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, (sizeof(APP_KIND) - 1));
|
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, (sizeof(APP_KIND) - 1));
|
||||||
|
|
||||||
keccak(input, inSize, hash);
|
keccak(input, inSize, hash);
|
||||||
Buffer::toHex(hash, 8, m_id);
|
Cvt::toHex(m_id, sizeof(m_id), hash, 8);
|
||||||
|
|
||||||
delete [] input;
|
delete [] input;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -67,6 +67,7 @@ set(HEADERS_BASE
|
||||||
src/base/tools/Baton.h
|
src/base/tools/Baton.h
|
||||||
src/base/tools/Buffer.h
|
src/base/tools/Buffer.h
|
||||||
src/base/tools/Chrono.h
|
src/base/tools/Chrono.h
|
||||||
|
src/base/tools/Cvt.h
|
||||||
src/base/tools/Handle.h
|
src/base/tools/Handle.h
|
||||||
src/base/tools/String.h
|
src/base/tools/String.h
|
||||||
src/base/tools/Timer.h
|
src/base/tools/Timer.h
|
||||||
|
@ -114,7 +115,7 @@ set(SOURCES_BASE
|
||||||
src/base/net/tools/LineReader.cpp
|
src/base/net/tools/LineReader.cpp
|
||||||
src/base/net/tools/NetBuffer.cpp
|
src/base/net/tools/NetBuffer.cpp
|
||||||
src/base/tools/Arguments.cpp
|
src/base/tools/Arguments.cpp
|
||||||
src/base/tools/Buffer.cpp
|
src/base/tools/Cvt.cpp
|
||||||
src/base/tools/String.cpp
|
src/base/tools/String.cpp
|
||||||
src/base/tools/Timer.cpp
|
src/base/tools/Timer.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#include "base/net/https/HttpsClient.h"
|
#include "base/net/https/HttpsClient.h"
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
#include "base/tools/Buffer.h"
|
#include "base/tools/Cvt.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -182,7 +182,7 @@ bool xmrig::HttpsClient::verifyFingerprint(X509 *cert)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::toHex(md, 32, m_fingerprint);
|
Cvt::toHex(m_fingerprint, sizeof(m_fingerprint), md, 32);
|
||||||
|
|
||||||
return req().fingerprint.isNull() || strncasecmp(m_fingerprint, req().fingerprint.data(), 64) == 0;
|
return req().fingerprint.isNull() || strncasecmp(m_fingerprint, req().fingerprint.data(), 64) == 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#include "base/net/dns/Dns.h"
|
#include "base/net/dns/Dns.h"
|
||||||
#include "base/net/stratum/Socks5.h"
|
#include "base/net/stratum/Socks5.h"
|
||||||
#include "base/net/tools/NetBuffer.h"
|
#include "base/net/tools/NetBuffer.h"
|
||||||
#include "base/tools/Buffer.h"
|
#include "base/tools/Cvt.h"
|
||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
#include "net/JobResult.h"
|
#include "net/JobResult.h"
|
||||||
|
|
||||||
|
@ -202,11 +202,8 @@ int64_t xmrig::Client::submit(const JobResult &result)
|
||||||
char *nonce = m_sendBuf.data();
|
char *nonce = m_sendBuf.data();
|
||||||
char *data = m_sendBuf.data() + 16;
|
char *data = m_sendBuf.data() + 16;
|
||||||
|
|
||||||
Buffer::toHex(reinterpret_cast<const char*>(&result.nonce), 4, nonce);
|
Cvt::toHex(nonce, sizeof(uint32_t) * 2 + 1, reinterpret_cast<const uint8_t *>(&result.nonce), sizeof(uint32_t));
|
||||||
nonce[8] = '\0';
|
Cvt::toHex(data, 65, result.result(), 32);
|
||||||
|
|
||||||
Buffer::toHex(result.result(), 32, data);
|
|
||||||
data[64] = '\0';
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
Document doc(kObjectType);
|
Document doc(kObjectType);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "base/net/http/HttpData.h"
|
#include "base/net/http/HttpData.h"
|
||||||
#include "base/net/http/HttpListener.h"
|
#include "base/net/http/HttpListener.h"
|
||||||
#include "base/net/stratum/SubmitResult.h"
|
#include "base/net/stratum/SubmitResult.h"
|
||||||
#include "base/tools/Buffer.h"
|
#include "base/tools/Cvt.h"
|
||||||
#include "base/tools/Timer.h"
|
#include "base/tools/Timer.h"
|
||||||
#include "net/JobResult.h"
|
#include "net/JobResult.h"
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ static const char *kHash = "hash";
|
||||||
static const char *kHeight = "height";
|
static const char *kHeight = "height";
|
||||||
static const char *kJsonRPC = "/json_rpc";
|
static const char *kJsonRPC = "/json_rpc";
|
||||||
|
|
||||||
static const size_t BlobReserveSize = 8;
|
static constexpr size_t kBlobReserveSize = 8;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ int64_t xmrig::DaemonClient::submit(const JobResult &result)
|
||||||
# ifdef XMRIG_PROXY_PROJECT
|
# ifdef XMRIG_PROXY_PROJECT
|
||||||
memcpy(data + 78, result.nonce, 8);
|
memcpy(data + 78, result.nonce, 8);
|
||||||
# else
|
# else
|
||||||
Buffer::toHex(reinterpret_cast<const uint8_t *>(&result.nonce), 4, data + 78);
|
Cvt::toHex(data + 78, 9, reinterpret_cast<const uint8_t *>(&result.nonce), 4);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
|
@ -227,7 +227,7 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value ¶ms, int *code)
|
||||||
m_blockhashingblob = Json::getString(params, "blockhashing_blob");
|
m_blockhashingblob = Json::getString(params, "blockhashing_blob");
|
||||||
if (m_apiVersion == API_DERO) {
|
if (m_apiVersion == API_DERO) {
|
||||||
const uint64_t offset = Json::getUint64(params, "reserved_offset");
|
const uint64_t offset = Json::getUint64(params, "reserved_offset");
|
||||||
Buffer::toHex(Buffer::randomBytes(BlobReserveSize).data(), BlobReserveSize, m_blockhashingblob.data() + offset * 2);
|
Cvt::toHex(m_blockhashingblob.data() + offset * 2, kBlobReserveSize * 2 + 1, Cvt::randomBytes(kBlobReserveSize).data(), kBlobReserveSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blocktemplate.isNull() || !job.setBlob(m_blockhashingblob)) {
|
if (blocktemplate.isNull() || !job.setBlob(m_blockhashingblob)) {
|
||||||
|
@ -315,10 +315,10 @@ int64_t xmrig::DaemonClient::getBlockTemplate()
|
||||||
Value params(kObjectType);
|
Value params(kObjectType);
|
||||||
params.AddMember("wallet_address", m_user.toJSON(), allocator);
|
params.AddMember("wallet_address", m_user.toJSON(), allocator);
|
||||||
if (m_apiVersion == API_DERO) {
|
if (m_apiVersion == API_DERO) {
|
||||||
params.AddMember("reserve_size", static_cast<uint64_t>(BlobReserveSize), allocator);
|
params.AddMember("reserve_size", static_cast<uint64_t>(kBlobReserveSize), allocator);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
params.AddMember("extra_nonce", Buffer::randomBytes(BlobReserveSize).toHex().toJSON(doc), allocator);
|
params.AddMember("extra_nonce", Cvt::toHex(Cvt::randomBytes(kBlobReserveSize)).toJSON(doc), allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonRequest::create(doc, m_sequence, "getblocktemplate", params);
|
JsonRequest::create(doc, m_sequence, "getblocktemplate", params);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "base/net/stratum/Job.h"
|
#include "base/net/stratum/Job.h"
|
||||||
#include "base/tools/Buffer.h"
|
#include "base/tools/Buffer.h"
|
||||||
|
#include "base/tools/Cvt.h"
|
||||||
|
|
||||||
|
|
||||||
xmrig::Job::Job(bool nicehash, const Algorithm &algorithm, const String &clientId) :
|
xmrig::Job::Job(bool nicehash, const Algorithm &algorithm, const String &clientId) :
|
||||||
|
@ -63,7 +64,7 @@ bool xmrig::Job::setBlob(const char *blob)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Buffer::fromHex(blob, m_size * 2, m_blob)) {
|
if (!Cvt::fromHex(m_blob, sizeof(m_blob), blob, m_size * 2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +91,9 @@ bool xmrig::Job::setSeedHash(const char *hash)
|
||||||
m_rawSeedHash = hash;
|
m_rawSeedHash = hash;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
m_seed = Buffer::fromHex(hash, kMaxSeedSize * 2);
|
m_seed = Cvt::fromHex(hash, kMaxSeedSize * 2);
|
||||||
|
|
||||||
return !m_seed.isEmpty();
|
return !m_seed.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,27 +103,14 @@ bool xmrig::Job::setTarget(const char *target)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t len = strlen(target);
|
const auto raw = Cvt::fromHex(target, strlen(target));
|
||||||
|
const size_t size = raw.size();
|
||||||
|
|
||||||
if (len <= 8) {
|
if (size == 4) {
|
||||||
uint32_t tmp = 0;
|
m_target = 0xFFFFFFFFFFFFFFFFULL / (0xFFFFFFFFULL / uint64_t(*reinterpret_cast<const uint32_t *>(raw.data())));
|
||||||
char str[8];
|
|
||||||
memcpy(str, target, len);
|
|
||||||
|
|
||||||
if (!Buffer::fromHex(str, 8, reinterpret_cast<uint8_t *>(&tmp)) || tmp == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_target = 0xFFFFFFFFFFFFFFFFULL / (0xFFFFFFFFULL / static_cast<uint64_t>(tmp));
|
|
||||||
}
|
}
|
||||||
else if (len <= 16) {
|
else if (size == 8) {
|
||||||
m_target = 0;
|
m_target = *reinterpret_cast<const uint64_t *>(raw.data());
|
||||||
char str[16];
|
|
||||||
memcpy(str, target, len);
|
|
||||||
|
|
||||||
if (!Buffer::fromHex(str, 16, reinterpret_cast<uint8_t *>(&m_target)) || m_target == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "base/net/stratum/Tls.h"
|
#include "base/net/stratum/Tls.h"
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
#include "base/net/stratum/Client.h"
|
#include "base/net/stratum/Client.h"
|
||||||
#include "base/tools/Buffer.h"
|
#include "base/tools/Cvt.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -183,7 +183,7 @@ bool xmrig::Client::Tls::verifyFingerprint(X509 *cert)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::toHex(md, 32, m_fingerprint);
|
Cvt::toHex(m_fingerprint, sizeof(m_fingerprint), md, 32);
|
||||||
const char *fingerprint = m_client->m_pool.fingerprint();
|
const char *fingerprint = m_client->m_pool.fingerprint();
|
||||||
|
|
||||||
return fingerprint == nullptr || strncasecmp(m_fingerprint, fingerprint, 64) == 0;
|
return fingerprint == nullptr || strncasecmp(m_fingerprint, fingerprint, 64) == 0;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "base/net/http/HttpData.h"
|
#include "base/net/http/HttpData.h"
|
||||||
#include "base/net/http/HttpListener.h"
|
#include "base/net/http/HttpListener.h"
|
||||||
#include "base/net/stratum/benchmark/BenchConfig.h"
|
#include "base/net/stratum/benchmark/BenchConfig.h"
|
||||||
|
#include "base/tools/Cvt.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,7 +218,7 @@ bool xmrig::BenchClient::setSeed(const char *seed)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Buffer::fromHex(seed, size * 2, m_job.blob())) {
|
if (!Cvt::fromHex(m_job.blob(), m_job.size(), seed, size * 2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,231 +0,0 @@
|
||||||
/* XMRig
|
|
||||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
|
||||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
|
||||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
|
||||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
|
||||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
|
||||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "base/tools/Buffer.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <random>
|
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
|
||||||
|
|
||||||
|
|
||||||
static std::random_device randomDevice;
|
|
||||||
static std::mt19937 randomEngine(randomDevice());
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace xmrig
|
|
||||||
|
|
||||||
|
|
||||||
static inline uint8_t hf_hex2bin(uint8_t c, bool &err)
|
|
||||||
{
|
|
||||||
if (c >= '0' && c <= '9') {
|
|
||||||
return c - '0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c >= 'a' && c <= 'f') {
|
|
||||||
return c - 'a' + 0xA;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c >= 'A' && c <= 'F') {
|
|
||||||
return c - 'A' + 0xA;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline uint8_t hf_bin2hex(uint8_t c)
|
|
||||||
{
|
|
||||||
if (c <= 0x9) {
|
|
||||||
return '0' + c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'a' - 0xA + c;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xmrig::Buffer::Buffer(Buffer &&other) noexcept :
|
|
||||||
m_data(other.m_data),
|
|
||||||
m_size(other.m_size)
|
|
||||||
{
|
|
||||||
other.m_data = nullptr;
|
|
||||||
other.m_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xmrig::Buffer::Buffer(const Buffer &other)
|
|
||||||
{
|
|
||||||
copy(other.data(), other.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xmrig::Buffer::Buffer(const char *data, size_t size)
|
|
||||||
{
|
|
||||||
copy(data, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xmrig::Buffer::Buffer(size_t size) :
|
|
||||||
m_size(size)
|
|
||||||
{
|
|
||||||
if (size > 0) {
|
|
||||||
m_data = new char[size]();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xmrig::Buffer::~Buffer()
|
|
||||||
{
|
|
||||||
delete [] m_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Buffer::from(const char *data, size_t size)
|
|
||||||
{
|
|
||||||
if (m_size > 0) {
|
|
||||||
if (m_size == size) {
|
|
||||||
memcpy(m_data, data, m_size);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete [] m_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
copy(data, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xmrig::Buffer xmrig::Buffer::allocUnsafe(size_t size)
|
|
||||||
{
|
|
||||||
if (size == 0) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
Buffer buf;
|
|
||||||
buf.m_size = size;
|
|
||||||
buf.m_data = new char[size];
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xmrig::Buffer xmrig::Buffer::randomBytes(const size_t size)
|
|
||||||
{
|
|
||||||
Buffer buf(size);
|
|
||||||
std::uniform_int_distribution<> dis(0, 255);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < size; ++i) {
|
|
||||||
buf.m_data[i] = static_cast<char>(dis(randomEngine));
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool xmrig::Buffer::fromHex(const uint8_t *in, size_t size, uint8_t *out)
|
|
||||||
{
|
|
||||||
bool error = false;
|
|
||||||
for (size_t i = 0; i < size; i += 2) {
|
|
||||||
out[i / 2] = static_cast<uint8_t>((hf_hex2bin(in[i], error) << 4) | hf_hex2bin(in[i + 1], error));
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xmrig::Buffer xmrig::Buffer::fromHex(const char *data, size_t size)
|
|
||||||
{
|
|
||||||
if (data == nullptr || size % 2 != 0) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
Buffer buf(size / 2);
|
|
||||||
if (!fromHex(data, size, buf.data())) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Buffer::toHex(const uint8_t *in, size_t size, uint8_t *out)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < size; i++) {
|
|
||||||
out[i * 2] = hf_bin2hex((in[i] & 0xF0) >> 4);
|
|
||||||
out[i * 2 + 1] = hf_bin2hex(in[i] & 0x0F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xmrig::String xmrig::Buffer::toHex() const
|
|
||||||
{
|
|
||||||
if (m_size == 0) {
|
|
||||||
return String();
|
|
||||||
}
|
|
||||||
|
|
||||||
char *buf = new char[m_size * 2 + 1];
|
|
||||||
buf[m_size * 2] = '\0';
|
|
||||||
|
|
||||||
toHex(m_data, m_size, buf);
|
|
||||||
|
|
||||||
return String(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Buffer::copy(const char *data, size_t size)
|
|
||||||
{
|
|
||||||
if (size == 0) {
|
|
||||||
m_data = nullptr;
|
|
||||||
m_size = 0;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_data = new char[size];
|
|
||||||
m_size = size;
|
|
||||||
|
|
||||||
memcpy(m_data, data, m_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Buffer::move(Buffer &&other)
|
|
||||||
{
|
|
||||||
if (m_size > 0) {
|
|
||||||
delete [] m_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_data = other.m_data;
|
|
||||||
m_size = other.m_size;
|
|
||||||
|
|
||||||
other.m_data = nullptr;
|
|
||||||
other.m_size = 0;
|
|
||||||
}
|
|
|
@ -1,12 +1,6 @@
|
||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
|
||||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
|
||||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
|
||||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -26,67 +20,14 @@
|
||||||
#define XMRIG_BUFFER_H
|
#define XMRIG_BUFFER_H
|
||||||
|
|
||||||
|
|
||||||
#include "base/tools/String.h"
|
#include <cstdint>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
class Buffer
|
using Buffer = std::vector<uint8_t>;
|
||||||
{
|
|
||||||
public:
|
|
||||||
Buffer() = default;
|
|
||||||
Buffer(Buffer &&other) noexcept;
|
|
||||||
Buffer(const Buffer &other);
|
|
||||||
Buffer(const char *data, size_t size);
|
|
||||||
Buffer(size_t size);
|
|
||||||
~Buffer();
|
|
||||||
|
|
||||||
|
|
||||||
inline bool isEmpty() const { return size() == 0; }
|
|
||||||
inline bool isEqual(const Buffer &other) const { return m_size == other.m_size && (m_size == 0 || memcmp(m_data, other.m_data, m_size) == 0); }
|
|
||||||
inline char *data() { return m_data; }
|
|
||||||
inline const char *data() const { return m_data; }
|
|
||||||
inline size_t size() const { return m_size; }
|
|
||||||
inline void from(const Buffer &other) { from(other.data(), other.size()); }
|
|
||||||
|
|
||||||
|
|
||||||
void from(const char *data, size_t size);
|
|
||||||
|
|
||||||
|
|
||||||
inline bool operator!=(const Buffer &other) const { return !isEqual(other); }
|
|
||||||
inline bool operator==(const Buffer &other) const { return isEqual(other); }
|
|
||||||
inline Buffer &operator=(Buffer &&other) noexcept { move(std::move(other)); return *this; }
|
|
||||||
inline Buffer &operator=(const Buffer &other) { from(other); return *this; }
|
|
||||||
|
|
||||||
|
|
||||||
static Buffer allocUnsafe(size_t size);
|
|
||||||
static Buffer randomBytes(const size_t size);
|
|
||||||
|
|
||||||
static inline Buffer alloc(size_t size) { return Buffer(size); }
|
|
||||||
|
|
||||||
|
|
||||||
inline static bool fromHex(const char *in, size_t size, char *out) { return fromHex(reinterpret_cast<const uint8_t *>(in), size, reinterpret_cast<uint8_t *>(out)); }
|
|
||||||
inline static bool fromHex(const char *in, size_t size, uint8_t *out) { return fromHex(reinterpret_cast<const uint8_t *>(in), size, out); }
|
|
||||||
inline static Buffer fromHex(const char *data) { return fromHex(data, strlen(data)); }
|
|
||||||
inline static Buffer fromHex(const String &str) { return fromHex(str.data(), str.size()); }
|
|
||||||
inline static String toHex(const char *in, size_t size) { return Buffer(in, size).toHex(); }
|
|
||||||
inline static String toHex(const uint8_t *in, size_t size) { return Buffer(reinterpret_cast<const char *>(in), size).toHex(); }
|
|
||||||
inline static void toHex(const char *in, size_t size, char *out) { return toHex(reinterpret_cast<const uint8_t *>(in), size, reinterpret_cast<uint8_t *>(out)); }
|
|
||||||
inline static void toHex(const uint8_t *in, size_t size, char *out) { return toHex(in, size, reinterpret_cast<uint8_t *>(out)); }
|
|
||||||
|
|
||||||
static bool fromHex(const uint8_t *in, size_t size, uint8_t *out);
|
|
||||||
static Buffer fromHex(const char *data, size_t size);
|
|
||||||
static void toHex(const uint8_t *in, size_t size, uint8_t *out);
|
|
||||||
String toHex() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void copy(const char *data, size_t size);
|
|
||||||
void move(Buffer &&other);
|
|
||||||
|
|
||||||
char *m_data = nullptr;
|
|
||||||
size_t m_size = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} /* namespace xmrig */
|
} /* namespace xmrig */
|
||||||
|
|
257
src/base/tools/Cvt.cpp
Normal file
257
src/base/tools/Cvt.cpp
Normal file
|
@ -0,0 +1,257 @@
|
||||||
|
/* XMRig
|
||||||
|
* Copyright (c) 2013-2020 Frank Denis <j at pureftpd dot org>
|
||||||
|
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "base/tools/Cvt.h"
|
||||||
|
#include "3rdparty/rapidjson/document.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <random>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_SODIUM
|
||||||
|
# include <sodium.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef XMRIG_SODIUM
|
||||||
|
static std::random_device randomDevice;
|
||||||
|
static std::mt19937 randomEngine(randomDevice());
|
||||||
|
|
||||||
|
|
||||||
|
static char *cvt_bin2hex(char *const hex, const size_t hex_maxlen, const unsigned char *const bin, const size_t bin_len)
|
||||||
|
{
|
||||||
|
size_t i = 0U;
|
||||||
|
unsigned int x;
|
||||||
|
int b;
|
||||||
|
int c;
|
||||||
|
|
||||||
|
if (bin_len >= SIZE_MAX / 2 || hex_maxlen <= bin_len * 2U) {
|
||||||
|
return nullptr; /* LCOV_EXCL_LINE */
|
||||||
|
}
|
||||||
|
|
||||||
|
while (i < bin_len) {
|
||||||
|
c = bin[i] & 0xf;
|
||||||
|
b = bin[i] >> 4;
|
||||||
|
x = (unsigned char) (87U + c + (((c - 10U) >> 8) & ~38U)) << 8 |
|
||||||
|
(unsigned char) (87U + b + (((b - 10U) >> 8) & ~38U));
|
||||||
|
hex[i * 2U] = (char) x;
|
||||||
|
x >>= 8;
|
||||||
|
hex[i * 2U + 1U] = (char) x;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
hex[i * 2U] = 0U;
|
||||||
|
|
||||||
|
return hex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int cvt_hex2bin(unsigned char *const bin, const size_t bin_maxlen, const char *const hex, const size_t hex_len, const char *const ignore, size_t *const bin_len, const char **const hex_end)
|
||||||
|
{
|
||||||
|
size_t bin_pos = 0U;
|
||||||
|
size_t hex_pos = 0U;
|
||||||
|
int ret = 0;
|
||||||
|
unsigned char c;
|
||||||
|
unsigned char c_acc = 0U;
|
||||||
|
unsigned char c_alpha0;
|
||||||
|
unsigned char c_alpha;
|
||||||
|
unsigned char c_num0;
|
||||||
|
unsigned char c_num;
|
||||||
|
unsigned char c_val;
|
||||||
|
unsigned char state = 0U;
|
||||||
|
|
||||||
|
while (hex_pos < hex_len) {
|
||||||
|
c = (unsigned char) hex[hex_pos];
|
||||||
|
c_num = c ^ 48U;
|
||||||
|
c_num0 = (c_num - 10U) >> 8;
|
||||||
|
c_alpha = (c & ~32U) - 55U;
|
||||||
|
c_alpha0 = ((c_alpha - 10U) ^ (c_alpha - 16U)) >> 8;
|
||||||
|
|
||||||
|
if ((c_num0 | c_alpha0) == 0U) {
|
||||||
|
if (ignore != nullptr && state == 0U && strchr(ignore, c) != nullptr) {
|
||||||
|
hex_pos++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
c_val = (c_num0 & c_num) | (c_alpha0 & c_alpha);
|
||||||
|
|
||||||
|
if (bin_pos >= bin_maxlen) {
|
||||||
|
ret = -1;
|
||||||
|
errno = ERANGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == 0U) {
|
||||||
|
c_acc = c_val * 16U;
|
||||||
|
} else {
|
||||||
|
bin[bin_pos++] = c_acc | c_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
state = ~state;
|
||||||
|
hex_pos++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state != 0U) {
|
||||||
|
hex_pos--;
|
||||||
|
errno = EINVAL;
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
bin_pos = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hex_end != nullptr) {
|
||||||
|
*hex_end = &hex[hex_pos];
|
||||||
|
} else if (hex_pos != hex_len) {
|
||||||
|
errno = EINVAL;
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bin_len != nullptr) {
|
||||||
|
*bin_len = bin_pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define sodium_bin2hex cvt_bin2hex
|
||||||
|
#define sodium_hex2bin cvt_hex2bin
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline bool fromHexImpl(T &buf, const char *in, size_t size)
|
||||||
|
{
|
||||||
|
assert(in != nullptr && size > 0);
|
||||||
|
if (in == nullptr || size == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf.resize(size / 2);
|
||||||
|
|
||||||
|
return sodium_hex2bin(reinterpret_cast<uint8_t *>(&buf.front()), buf.size(), in, size, nullptr, nullptr, nullptr) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Cvt::fromHex(Buffer &buf, const char *in, size_t size)
|
||||||
|
{
|
||||||
|
return fromHexImpl(buf, in, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Cvt::fromHex(Buffer &buf, const rapidjson::Value &value)
|
||||||
|
{
|
||||||
|
if (!value.IsString()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fromHexImpl(buf, value.GetString(), value.GetStringLength());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Cvt::fromHex(std::string &buf, const char *in, size_t size)
|
||||||
|
{
|
||||||
|
return fromHexImpl(buf, in, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Cvt::fromHex(uint8_t *bin, size_t bin_maxlen, const char *hex, size_t hex_len)
|
||||||
|
{
|
||||||
|
assert(hex != nullptr && hex_len > 0);
|
||||||
|
if (hex == nullptr || hex_len == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sodium_hex2bin(bin, bin_maxlen, hex, hex_len, nullptr, nullptr, nullptr) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Cvt::fromHex(uint8_t *bin, size_t max, const rapidjson::Value &value)
|
||||||
|
{
|
||||||
|
if (!value.IsString()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fromHex(bin, max, value.GetString(), value.GetStringLength());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xmrig::Buffer xmrig::Cvt::fromHex(const char *in, size_t size)
|
||||||
|
{
|
||||||
|
Buffer buf;
|
||||||
|
if (!fromHex(buf, in, size)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Cvt::toHex(char *hex, size_t hex_maxlen, const uint8_t *bin, size_t bin_len)
|
||||||
|
{
|
||||||
|
return sodium_bin2hex(hex, hex_maxlen, bin, bin_len) != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xmrig::Buffer xmrig::Cvt::randomBytes(const size_t size)
|
||||||
|
{
|
||||||
|
Buffer buf(size);
|
||||||
|
|
||||||
|
# ifndef XMRIG_SODIUM
|
||||||
|
std::uniform_int_distribution<> dis(0, 255);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < size; ++i) {
|
||||||
|
buf[i] = static_cast<char>(dis(randomEngine));
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
randombytes_buf(buf.data(), size);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xmrig::String xmrig::Cvt::toHex(const uint8_t *in, size_t size)
|
||||||
|
{
|
||||||
|
assert(in != nullptr && size > 0);
|
||||||
|
if (in == nullptr || size == 0) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t hex_maxlen = size * 2 + 1;
|
||||||
|
|
||||||
|
char *buf = new char[hex_maxlen];
|
||||||
|
if (!toHex(buf, hex_maxlen, in, size)) {
|
||||||
|
delete [] buf;
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
58
src/base/tools/Cvt.h
Normal file
58
src/base/tools/Cvt.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/* XMRig
|
||||||
|
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XMRIG_CVT_H
|
||||||
|
#define XMRIG_CVT_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "3rdparty/rapidjson/fwd.h"
|
||||||
|
#include "base/tools/Buffer.h"
|
||||||
|
#include "base/tools/String.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
class Cvt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline static bool fromHex(Buffer &buf, const String &hex) { return fromHex(buf, hex.data(), hex.size()); }
|
||||||
|
inline static Buffer fromHex(const std::string &hex) { return fromHex(hex.data(), hex.size()); }
|
||||||
|
inline static Buffer fromHex(const String &hex) { return fromHex(hex.data(), hex.size()); }
|
||||||
|
inline static String toHex(const Buffer &data) { return toHex(data.data(), data.size()); }
|
||||||
|
inline static String toHex(const std::string &data) { return toHex(reinterpret_cast<const uint8_t *>(data.data()), data.size()); }
|
||||||
|
|
||||||
|
static bool fromHex(Buffer &buf, const char *in, size_t size);
|
||||||
|
static bool fromHex(Buffer &buf, const rapidjson::Value &value);
|
||||||
|
static bool fromHex(std::string &buf, const char *in, size_t size);
|
||||||
|
static bool fromHex(uint8_t *bin, size_t bin_maxlen, const char *hex, size_t hex_len);
|
||||||
|
static bool fromHex(uint8_t *bin, size_t bin_maxlen, const rapidjson::Value &value);
|
||||||
|
static bool toHex(char *hex, size_t hex_maxlen, const uint8_t *bin, size_t bin_len);
|
||||||
|
static Buffer fromHex(const char *in, size_t size);
|
||||||
|
static Buffer randomBytes(size_t size);
|
||||||
|
static String toHex(const uint8_t *in, size_t size);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* XMRIG_CVT_H */
|
|
@ -30,6 +30,7 @@
|
||||||
#include "base/io/Async.h"
|
#include "base/io/Async.h"
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
#include "base/io/log/Tags.h"
|
#include "base/io/log/Tags.h"
|
||||||
|
#include "base/tools/Cvt.h"
|
||||||
#include "crypto/rx/RxBasicStorage.h"
|
#include "crypto/rx/RxBasicStorage.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@ void xmrig::RxQueue::backgroundInit()
|
||||||
item.nodeset.size() > 1 ? "s" : "",
|
item.nodeset.size() > 1 ? "s" : "",
|
||||||
item.seed.algorithm().shortName(),
|
item.seed.algorithm().shortName(),
|
||||||
item.threads,
|
item.threads,
|
||||||
Buffer::toHex(item.seed.data().data(), 8).data()
|
Cvt::toHex(item.seed.data().data(), 8).data()
|
||||||
);
|
);
|
||||||
|
|
||||||
m_storage->init(item.seed, item.threads, item.hugePages, item.oneGbPages, item.mode, item.priority);
|
m_storage->init(item.seed, item.threads, item.hugePages, item.oneGbPages, item.mode, item.priority);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "base/net/stratum/strategies/FailoverStrategy.h"
|
#include "base/net/stratum/strategies/FailoverStrategy.h"
|
||||||
#include "base/net/stratum/strategies/SinglePoolStrategy.h"
|
#include "base/net/stratum/strategies/SinglePoolStrategy.h"
|
||||||
#include "base/tools/Buffer.h"
|
#include "base/tools/Buffer.h"
|
||||||
|
#include "base/tools/Cvt.h"
|
||||||
#include "base/tools/Timer.h"
|
#include "base/tools/Timer.h"
|
||||||
#include "core/config/Config.h"
|
#include "core/config/Config.h"
|
||||||
#include "core/Controller.h"
|
#include "core/Controller.h"
|
||||||
|
@ -65,9 +66,9 @@ xmrig::DonateStrategy::DonateStrategy(Controller *controller, IStrategyListener
|
||||||
{
|
{
|
||||||
uint8_t hash[200];
|
uint8_t hash[200];
|
||||||
|
|
||||||
const String &user = controller->config()->pools().data().front().user();
|
const auto &user = controller->config()->pools().data().front().user();
|
||||||
keccak(reinterpret_cast<const uint8_t *>(user.data()), user.size(), hash);
|
keccak(reinterpret_cast<const uint8_t *>(user.data()), user.size(), hash);
|
||||||
Buffer::toHex(hash, 32, m_userId);
|
Cvt::toHex(m_userId, sizeof(m_userId), hash, 32);
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_KAWPOW
|
# ifdef XMRIG_ALGO_KAWPOW
|
||||||
constexpr Pool::Mode mode = Pool::MODE_AUTO_ETH;
|
constexpr Pool::Mode mode = Pool::MODE_AUTO_ETH;
|
||||||
|
|
Loading…
Reference in a new issue