forked from nique_372/CryptoByLeo
45 lines
1.5 KiB
MQL5
45 lines
1.5 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Test.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
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
#include "Main.mqh"
|
|
#include <TSN\\BInt\\NUtils.mqh>
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Script program start function |
|
|
//+------------------------------------------------------------------+
|
|
void OnStart()
|
|
{
|
|
//---
|
|
uchar msg[];
|
|
string str_mes = "Este es un mensaje";
|
|
StringToCharArray(str_mes, msg, 0, StringLen(str_mes));
|
|
|
|
|
|
//---
|
|
uchar salt[];
|
|
ArrayResize(salt, 32);
|
|
ArrayInitialize(salt, 0xaa);
|
|
|
|
//---
|
|
uchar out[];
|
|
// 2048-1 = em bits
|
|
const int t = TSN::CPSS::Encode(msg, 32, salt, 2047, TSN::CCryptoHashMeta::TSN_CRYPTO_HASH_TYPE_SHA256, out);
|
|
|
|
|
|
//---
|
|
string str = "";
|
|
Print(t);
|
|
TSN::CNumberUtils::BytesToHexLower(out, t, str);
|
|
Print(str);
|
|
}
|
|
//+------------------------------------------------------------------+
|