2026-08-10 16:05:10 -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-19 21:20:19 -05:00 | | | #include <TSN\\BInt\\NUtils.mqh>
|
2026-08-10 16:05:10 -05:00 | | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| Script program start function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnStart()
|
| | | {
|
| | | //---
|
| | | string secret_key = "mi_clave_secreta";
|
| | | string message = "mensaje a firmar";
|
| | |
|
2026-08-13 16:13:23 -05:00 | | |
|
| | | uchar key[];
|
| | | uchar msg[];
|
2026-08-10 16:05:10 -05:00 | | |
|
| | | int key_len = StringToCharArray(secret_key, key, 0, -1, CP_UTF8);
|
| | | ArrayResize(key, key_len - 1); // quitar el null terminator
|
| | |
|
| | | int msg_len = StringToCharArray(message, msg, 0, -1, CP_UTF8);
|
| | | ArrayResize(msg, msg_len - 1); // quitar el null terminator
|
| | |
|
| | |
|
2026-08-13 18:48:30 -05:00 | | | TSN::CHMac hmac(key, msg, TSN::CCryptoHashMeta::TSN_CRYPTO_HASH_TYPE_SHA256);
|
2026-08-13 16:13:23 -05:00 | | | string str = "";
|
2026-09-26 21:47:11 -05:00 | | | TSN::CHexUtils::BytesToHexUpper(hmac.m_out, 32, str);
|
2026-08-13 16:13:23 -05:00 | | | Print(str);
|
2026-08-10 16:05:10 -05:00 | | |
|
2026-08-13 16:13:23 -05:00 | | | // 963DEA2D00F7FFFF21092A4B62F9CE9410ABD340AC51F8D6649C4AD056DCF9C2 resultado
|
| | | // 963dea2d00f7ffff21092a4b62f9ce9410abd340ac51f8d6649c4ad056dcf9c2 verificacion
|
2026-08-10 16:05:10 -05:00 | | | }
|
| | | //+------------------------------------------------------------------+
|