2026-08-19 17:43:41 -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>
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | class CRandomTest
|
| | | {
|
| | | public:
|
| | | CRandomTest(void) {}
|
| | | ~CRandomTest(void) {}
|
| | |
|
| | | static void Random(uchar& out[], int olt, int i)
|
| | | {
|
| | | olt += i;
|
| | | for(; i < olt; i++)
|
| | | {
|
| | | out[i] = 0xAA;
|
| | | }
|
| | | }
|
| | | };
|
2026-08-19 17:43:41 -05:00 | | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| Script program start function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnStart()
|
| | | {
|
2026-08-20 17:22:07 -05:00 | | | //--- mensaje
|
2026-08-19 21:20:19 -05:00 | | | string mensaje_str = "hola mundo";
|
| | | uchar mensaje[];
|
| | | StringToCharArray(mensaje_str, mensaje, 0, StringLen(mensaje_str));
|
| | |
|
2026-08-20 17:22:07 -05:00 | | | //--- random
|
| | | uchar random[];
|
| | | ArrayResize(random, CRYPTOBYLEO_SHA256_SIZET_FHASH);
|
| | | CRandomTest::Random(random, CRYPTOBYLEO_SHA256_SIZET_FHASH, 0);
|
| | |
|
2026-08-19 21:20:19 -05:00 | | | //---
|
| | | uchar coded[];
|
| | | ulong a = GetMicrosecondCount();
|
| | | for(int i = 0; i < 5000; i++)
|
| | | {
|
2026-08-20 17:22:07 -05:00 | | | TSN::COAEP::Encode(mensaje, 256, random, TSN::CCryptoHashMeta::TSN_CRYPTO_HASH_TYPE_SHA256, coded);
|
2026-08-19 21:20:19 -05:00 | | | }
|
| | | ulong b = GetMicrosecondCount();
|
| | | Print("time: ", (b - a));
|
2026-09-26 21:47:11 -05:00 | | |
|
2026-08-19 21:20:19 -05:00 | | |
|
| | | //---
|
| | | string str = "";
|
2026-09-26 21:47:11 -05:00 | | | TSN::CHexUtils::BytesToHexLower(coded, 256, str);
|
2026-08-19 21:20:19 -05:00 | | | Print(str[0]);
|
2026-08-19 17:43:41 -05:00 | | | }
|
| | | //+------------------------------------------------------------------+
|