CryptoByLeo/Src/Padding/PSS/Test.mq5

45 lines
1.5 KiB
MQL5
Raw Permalink Normal View History

2026-08-20 22:31:48 -05:00
//+------------------------------------------------------------------+
//| 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"
2026-08-21 07:46:28 -05:00
#include <TSN\\BInt\\NUtils.mqh>
2026-08-20 22:31:48 -05:00
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
2026-08-21 07:46:28 -05:00
{
2026-08-20 22:31:48 -05:00
//---
2026-08-21 07:46:28 -05:00
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);
}
2026-08-20 22:31:48 -05:00
//+------------------------------------------------------------------+