MQLArticles/Utils/Encrypt/TestString.mq5
2026-03-26 18:15:47 -05:00

32 lines
1.4 KiB
MQL5

//+------------------------------------------------------------------+
//| TestString.mq5 |
//| Copyright 2026, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "Encrypt.mqh"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
CEncryptor encryptor;
CRandomSimple random;
encryptor.SetAleatoryKey(CRYPT_AES256, RandomSimpleGenerateRandomUchar, &random);
Print("Key=", encryptor.Key());
string out = "";
encryptor.EncryptText("algo importante", CRYPT_AES256, out);
Print("Texto encriptdo=", out);
encryptor.DecryptText(out, CRYPT_AES256, out);
Print("Texto desencriptado=", out);
}
//+------------------------------------------------------------------+