Added Cvt class.

This commit is contained in:
XMRig 2020-12-02 16:31:45 +07:00
parent 469b1f08de
commit 63bd45c397
No known key found for this signature in database
GPG key ID: 446A53638BE94409
14 changed files with 355 additions and 341 deletions

View file

@ -34,8 +34,8 @@
#include "base/io/Env.h"
#include "base/io/json/Json.h"
#include "base/kernel/Base.h"
#include "base/tools/Buffer.h"
#include "base/tools/Chrono.h"
#include "base/tools/Cvt.h"
#include "core/config/Config.h"
#include "core/Controller.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 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 + sizeof(uint16_t), interfaces[i].phys_addr, addrSize);
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, (sizeof(APP_KIND) - 1));
keccak(input, inSize, hash);
Buffer::toHex(hash, 8, m_id);
Cvt::toHex(m_id, sizeof(m_id), hash, 8);
delete [] input;
break;