CryptoByLeo/Src/Utils/Main.mqh

77 lignes
2,6 Kio
MQL5
Brut Lien permanent Vue normale Historique

2026-08-12 13:31:16 -05:00
//+------------------------------------------------------------------+
//| Main.mqh |
//| Copyright 2026, Niquel Mendoza |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza"
#property link "https://www.mql5.com"
#property strict
#ifndef CRYPTOBYLEO_SRC_UTILS_MAIN_MQH
#define CRYPTOBYLEO_SRC_UTILS_MAIN_MQH
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#ifndef TSNTABLE_USE_HEX_TABLE
#define TSNTABLE_USE_HEX_TABLE
#endif // TSNTABLE_USE_HEX_TABLE
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include <TSN\\Tables\\Main.mqh>
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
namespace TSN
{
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
class CEncrptUtils
{
public:
CEncrptUtils(void) {}
~CEncrptUtils(void) {}
static void ToHexUpper(const uchar& raw[], string& out);
};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
static void CEncrptUtils::ToHexUpper(const uchar &raw[], string& out)
{
//---
static const ushort digitos[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
//---
const int t = ArraySize(raw);
ushort buf[];
ArrayResize(buf, t << 1);
//---
int w = 0;
for(int i = 0; i < t; i++)
{
const uchar num = raw[i];
buf[w++] = digitos[num >> 4]; // parte alta
buf[w++] = digitos[num & 15]; // parte baja
}
//----
//ArrayResize(buf, w);
//---
out = ShortArrayToString(buf, 0, w);
}
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
#endif // CRYPTOBYLEO_SRC_UTILS_MAIN_MQH