using System.Security.Cryptography;
private static string password = "W1S2020";
private static readonly byte[] IV = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
private const int BlockSize = 128;
public static void Main()
byte[] bytes = Encoding.Unicode.GetBytes(texto);
SymmetricAlgorithm crypt = Aes.Create();
HashAlgorithm hash = MD5.Create();
crypt.BlockSize = BlockSize;
crypt.Key = hash.ComputeHash(Encoding.Unicode.GetBytes(password));
using (MemoryStream memoryStream = new MemoryStream())
using (CryptoStream cryptoStream =
new CryptoStream(memoryStream, crypt.CreateEncryptor(), CryptoStreamMode.Write))
cryptoStream.Write(bytes, 0, bytes.Length);
Console.WriteLine(Convert.ToBase64String(memoryStream.ToArray()));