75 lines
2.3 KiB
MQL5
75 lines
2.3 KiB
MQL5
//+------------------------------------------------------------------+
| |||
//| Repro.mq5 |
| |||
//| Copyright 2026, Niquel Mendoza |
| |||
//| https://www.mql5.com |
| |||
//+------------------------------------------------------------------+
| |||
#property copyright "Copyright 2026, Niquel Mendoza"
| |||
#property link "https://www.mql5.com"
| |||
#property version "1.00"
| |||
#property strict
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| |
| |||
//+------------------------------------------------------------------+
| |||
namespace TSN
| |||
{
| |||
//+------------------------------------------------------------------+
| |||
//| |
| |||
//+------------------------------------------------------------------+
| |||
class CFernet
| |||
{
| |||
private:
| |||
uchar hmac[16];
| |||
uchar aes[16];
| |||
| |||
public:
| |||
CFernet(void) {}
| |||
~CFernet(void) {}
| |||
| |||
//---
| |||
void PrintData();
| |||
template <typename TCryptoRandomFunc>
| |||
void AutoKey();
| |||
};
| |||
| |||
template <typename TCryptoRandomFunc>
| |||
void CFernet::AutoKey() // 'CFernet' - struct undefined Repro.mq5 36 6
| |||
{
| |||
uchar key[32];
| |||
TCryptoRandomFunc::Fill(key, 32, 0);
| |||
ArrayCopy(hmac, key, 0, 0, 16);
| |||
ArrayCopy(aes, key, 0, 16, 16);
| |||
}
| |||
| |||
void CFernet::PrintData(void)
| |||
{
| |||
ArrayPrint(hmac, 1, "|");
| |||
ArrayPrint(aes, 1, "|");
| |||
}
| |||
}
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| |
| |||
//+------------------------------------------------------------------+
| |||
class CFiller
| |||
{
| |||
public:
| |||
CFiller(void) {}
| |||
~CFiller(void) {}
| |||
| |||
static void Fill(uchar& out[], int oult, int o_s = 0)
| |||
{
| |||
ArrayFill(out, o_s, oult, 0);
| |||
}
| |||
};
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| |
| |||
//+------------------------------------------------------------------+
| |||
void OnStart(void)
| |||
{
| |||
TSN::CFernet fernet;
| |||
fernet.AutoKey<CFiller>(); //
| |||
fernet.PrintData();
| |||
}
| |||
//+------------------------------------------------------------------+
|