[VB6 equivalent: PAD_BytesBlock]
Dim abInput() As Byte Dim abOutput() As Byte Dim nInputLen As Integer Dim i As Integer ' Prepare test input 5 bytes long nInputLen = 5 ReDim abInput(nInputLen - 1) For i = 0 To nInputLen - 1 abInput(i) = &HFF Next Console.WriteLine("Input data=0x" & Cnv.ToHex(abInput)) ' [VB.NET] In .NET, if we know the cipher algorithm, we can pad directly abOutput = Tdea.Pad(abInput) Console.WriteLine("Padded data=0x" & Cnv.ToHex(abOutput)) ' Now set input as padded output and remove padding abInput = abOutput ' Remove padding... abOutput = Tdea.Unpad(abInput) Console.WriteLine("Unpadded data=0x" & Cnv.ToHex(abOutput))
See Also:
Cipher.Pad Method (Byte[], CipherAlgorithm, Padding)