MICA: Jak jako „je generováno 32 bajtů“?
using (var aes = new AesManaged { Mode = CipherMode.ECB, Padding = PaddingMode.None })
{
aes.GenerateIV();
aes.GenerateKey();
var origData = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
var encryptedData = new byte[16];
var decryptedData = new byte[16];
using (var encryptor = aes.CreateEncryptor())
{
encryptor.TransformBlock(origData, 0, 16, encryptedData, 0);
}
using (var decryptor = aes.CreateDecryptor())
{
decryptor.TransformBlock(encryptedData, 0, 16, decryptedData, 0);
}
encryptedData.Dump();
decryptedData.Dump();
}