2026-08-25 09:19:11 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| EA.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"
|
2026-08-26 09:31:56 -05:00 | | | #property strict
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | #define TSN_MQLCI_INLINE_TEST
|
| | |
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | #include "TestNistVectors.mqh"
|
| | |
|
| | | //---
|
| | | MQLARTICLES_STRUCTBYTES_CRE(SHA3_256_OUT_BSIZE)
|
| | | MQLARTICLES_STRUCTBYTES_CRE(SHA3_512_OUT_BSIZE)
|
| | | MQLARTICLES_STRUCTBYTES_CRE(SHA3_384_OUT_BSIZE)
|
| | |
|
| | | //---
|
| | | MQLARTICLES_STRUCTBYTES_CRE(CRYPTOBYLEO_SHA512_SIZET_FHASH)
|
| | | MQLARTICLES_STRUCTBYTES_CRE(CRYPTOBYLEO_SHA512_224_SIZET_FHASH)
|
| | | MQLARTICLES_STRUCTBYTES_CRE(CRYPTOBYLEO_SHA512_256_SIZET_FHASH)
|
| | | MQLARTICLES_STRUCTBYTES_CRE(CRYPTOBYLEO_SHA384_SIZET_FHASH)
|
| | |
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| Inputs |
|
| | | //+------------------------------------------------------------------+
|
| | | input long InpCharId = 0;
|
| | | input string InpTestName = "CryptoByLeo - Full Suite";
|
| | |
|
2026-08-25 09:19:11 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| Expert initialization function |
|
| | | //+------------------------------------------------------------------+
|
| | | int OnInit()
|
2026-08-26 09:31:56 -05:00 | | | {
|
| | | //---
|
| | | TSN::CiTestUtil util;
|
| | | util.AddLogFlags(LOG_ALL);
|
2026-08-26 10:02:05 -05:00 | | | util.TestSize(13);
|
2026-08-26 09:31:56 -05:00 | | |
|
| | | //---
|
| | | int i = 0;
|
2026-08-26 10:02:05 -05:00 | | |
|
| | | //--- SHA2
|
2026-09-02 07:22:44 -05:00 | | | util.SetTestPtr(i++, new TSN::CTestNistVectors_SHA<MQLARTICLES_STRUCT_BYTES_SHA3_256_OUT_BSIZE>(
|
2026-08-26 10:02:05 -05:00 | | | "SHA2-256 Test NIST Vectors", TSN::g_rsptestvector_sha2_256_fn, TSN::CCryptoHash::SHA256));
|
| | | util.SetTestPtr(i++, new TSN::CTestNistVectors_SHA<MQLARTICLES_STRUCT_BYTES_CRYPTOBYLEO_SHA384_SIZET_FHASH>(
|
| | | "SHA2-384 Test NIST Vectors", TSN::g_rsptestvector_sha2_384_fn, TSN::CCryptoHash::SHA384));
|
| | | util.SetTestPtr(i++, new TSN::CTestNistVectors_SHA<MQLARTICLES_STRUCT_BYTES_CRYPTOBYLEO_SHA512_SIZET_FHASH>(
|
| | | "SHA2-512 Test NIST Vectors", TSN::g_rsptestvector_sha2_512_fn, TSN::CCryptoHash::SHA512));
|
| | | util.SetTestPtr(i++, new TSN::CTestNistVectors_SHA<MQLARTICLES_STRUCT_BYTES_CRYPTOBYLEO_SHA512_224_SIZET_FHASH>(
|
| | | "SHA2-512/224 Test NIST Vectors", TSN::g_rsptestvector_sha2_512_224_fn, TSN::CCryptoHash::SHA512_224));
|
| | | util.SetTestPtr(i++, new TSN::CTestNistVectors_SHA<MQLARTICLES_STRUCT_BYTES_CRYPTOBYLEO_SHA512_256_SIZET_FHASH>(
|
| | | "SHA2-512/256 Test NIST Vectors", TSN::g_rsptestvector_sha2_512_256_fn, TSN::CCryptoHash::SHA512_256));
|
| | |
|
| | | //--- SHA3
|
| | | util.SetTestPtr(i++, new TSN::CTestNistVectors_SHA<MQLARTICLES_STRUCT_BYTES_SHA3_256_OUT_BSIZE>(
|
| | | "SHA3-256 Test NIST Vectors", TSN::g_rsptestvector_sha3_256_fn, TSN::CCryptoHashSHA3::SHA3_256));
|
| | | util.SetTestPtr(i++, new TSN::CTestNistVectors_SHA<MQLARTICLES_STRUCT_BYTES_SHA3_384_OUT_BSIZE>(
|
| | | "SHA3-384 Test NIST Vectors", TSN::g_rsptestvector_sha3_384_fn, TSN::CCryptoHashSHA3::SHA3_384));
|
2026-08-26 09:31:56 -05:00 | | | util.SetTestPtr(i++, new TSN::CTestNistVectors_SHA<MQLARTICLES_STRUCT_BYTES_SHA3_512_OUT_BSIZE>(
|
2026-08-26 10:02:05 -05:00 | | | "SHA3-512 Test NIST Vectors", TSN::g_rsptestvector_sha3_512_fn, TSN::CCryptoHashSHA3::SHA3_512));
|
| | |
|
| | | //--- BLAKE2
|
| | | util.SetTestPtr(i++, new TSN::CTest_BLAKE2());
|
| | |
|
| | | //--- AES ECB
|
| | | util.SetTestPtr(i++, new TSN::CTest_AES_ECB(TSN::g_rsptestvector_aes_ecb_128, "AES-128 ECB Test NIST Vectors", TSN::AES_CRYPTH_128));
|
| | | util.SetTestPtr(i++, new TSN::CTest_AES_ECB(TSN::g_rsptestvector_aes_ecb_256, "AES-256 ECB Test NIST Vectors", TSN::AES_CRYPTH_256));
|
2026-08-26 09:31:56 -05:00 | | |
|
2026-08-26 10:02:05 -05:00 | | | //--- AES CBC
|
| | | util.SetTestPtr(i++, new TSN::CTest_AES_CBC(TSN::g_rsptestvector_aes_cbc_128, "AES-128 CBC Test NIST Vectors", TSN::AES_CRYPTH_128));
|
2026-08-26 10:58:53 -05:00 | | | util.SetTestPtr(i++, new TSN::CTest_AES_CBC(TSN::g_rsptestvector_aes_cbc_256, "AES-256 CBC Test NIST Vectors", TSN::AES_CRYPTH_256));
|
2026-08-26 09:31:56 -05:00 | | |
|
2026-08-25 09:19:11 -05:00 | | | //---
|
2026-08-26 10:02:05 -05:00 | | | if(i != 13)
|
2026-08-26 09:31:56 -05:00 | | | {
|
| | | #ifdef TSN_MQLCI_INLINE_TEST
|
2026-08-26 10:02:05 -05:00 | | | PrintFormat("ERROR: se instanciaron %d tests, esperado 13 (revisar Test.mq5)", i);
|
2026-08-26 09:31:56 -05:00 | | | return INIT_FAILED;
|
| | | #else TSN_MQLCI_INLINE_TEST
|
| | | ::EventChartCustom(m_chart_id, CIBYLEO_ONEVENT_RES, CYBYLEO_CODE_ERROR, 0.00, m_test_name);
|
| | | return CIBYLEO_ONINIT_FINISH;
|
| | | #endif // TSN_MQLCI_INLINE_TEST
|
| | | }
|
| | |
|
| | | //--- (chart_id, min_importance_for_early_exit, label, min_percentage_to_pass)
|
| | | util.Init(InpCharId, 70, InpTestName, 90.0);
|
| | | #ifdef TSN_MQLCI_INLINE_TEST
|
| | | if(!util.RunAllTestAndSend())
|
| | | {
|
| | | FastLog(FUNCION_ACTUAL, FATAL_ERROR_TEXT, InpTestName);
|
| | | return CIBYLEO_ONINIT_FINISH;
|
| | | }
|
| | | #else
|
| | | util.RunAllTestAndSend();
|
| | | #endif //TSN_MQLCI_INLINE_TEST
|
| | |
|
2026-08-25 09:19:11 -05:00 | | | //---
|
2026-08-26 09:31:56 -05:00 | | | return CIBYLEO_ONINIT_FINISH;
|
| | | return(INIT_SUCCEEDED);
|
| | | }
|
| | |
|
2026-08-25 09:19:11 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| Expert deinitialization function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnDeinit(const int reason)
|
2026-08-26 09:31:56 -05:00 | | | {
|
2026-08-25 09:19:11 -05:00 | | | //---
|
2026-08-26 09:31:56 -05:00 | | | }
|
| | |
|
2026-08-25 09:19:11 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| Expert tick function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnTick()
|
2026-08-26 09:31:56 -05:00 | | | {
|
2026-08-25 09:19:11 -05:00 | | | //---
|
2026-08-26 09:31:56 -05:00 | | | }
|
2026-08-25 09:19:11 -05:00 | | | //+------------------------------------------------------------------+
|