[VB6 equivalent: AES128_Update]
Dim nRet As Integer Dim abBlock() As Byte Dim abKey() As Byte Dim abCorrect() As Byte Dim j As Integer Dim oAes128 As Aes128 = Aes128.Instance() ' File: ecb_d_m.txt ' KEYSIZE=128 I=2 ' KEY=A7BC3BD0EABD9EBA981E23E6FFC9C9C2 ' CT=E3FD51123B48A2E2AB1DB29894202222 ' PT=877B88A77AEF04F05546539E17259F53 ' Convert to Byte format abKey = Cnv.FromHex("A7BC3BD0EABD9EBA981E23E6FFC9C9C2") abBlock = Cnv.FromHex("E3FD51123B48A2E2AB1DB29894202222") abCorrect = Cnv.FromHex("877B88A77AEF04F05546539E17259F53") Console.WriteLine("AES Monte Carlo ECB Mode Decrypt:") Console.WriteLine("KY=" & " " & Cnv.ToHex(abKey)) Console.WriteLine("CT=" & " " & Cnv.ToHex(abBlock)) nRet = oAes128.InitDecrypt(abKey, Mode.ECB, Nothing) If nRet <> 0 Then Console.WriteLine("ERROR: Failed to set context") Exit Sub End If ' Do 10,000 times For j = 0 To 9999 abBlock = oAes128.Update(abBlock) Next Console.WriteLine("PT=" & " " & Cnv.ToHex(abBlock)) Console.WriteLine("OK=" & " " & Cnv.ToHex(abCorrect)) oAes128.Dispose() Debug.Assert(Cnv.ToHex(abCorrect) = Cnv.ToHex(abBlock))
See Also:
Aes128.Update Method (Byte[])