fork(7) 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.UTF8.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.13s 24376KB
stdin
Standard input is empty
stdout
aa429aa5c1c928b86d81b43ff3fb6cc46f24cc73957bc7c00829357bf441eb3be9cf8aef2ff6f819f9b95c69886b169b6959c4f7ece0620c6a28f849516adee9