fork download
  1. using System;
  2. using System.IO;
  3. using System.Security.Cryptography;
  4. using System.Text;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. byte[] key = new byte[]
  11. {
  12. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  13. 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
  14. 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
  15. 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
  16. };
  17.  
  18. byte[] iv = new byte[]
  19. {
  20. 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  21. 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
  22. };
  23.  
  24. byte[] clearData = Encoding.Unicode.GetBytes("Hello world! This is a wonderful day! àèéìòù");
  25.  
  26. using (Rijndael alg = Rijndael.Create())
  27. {
  28. alg.Key = key;
  29. alg.IV = iv;
  30.  
  31. using (var ms = new MemoryStream())
  32. {
  33. CryptoStream cs = new CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write);
  34. cs.Write(clearData, 0, clearData.Length);
  35. cs.Close();
  36. byte[] encryptedData = ms.ToArray();
  37. Console.WriteLine(BitConverter.ToString(encryptedData).Replace("-", "").ToLowerInvariant());
  38. }
  39. }
  40. }
  41. }
Success #stdin #stdout 0.11s 24352KB
stdin
Standard input is empty
stdout
e47e6552873b2993e5183a1592fbfddad0fd52f0f6f039548b92dbd829242939a70cf0e7620db6bc690da30eebce9967646bd1c627cf2ecc65a7ebe9606237671d4187192d328a406ff63d7fb7bbd010de01737e960482e3d6220d9b4834058e