I have studied that DES CBC algorithm generate 64 bits (8 byte Hex) encrypted output but when i implement the algorithm in vb.net it gives the same length output as my plain text.i need help on how i obtain 8 byte encrypted output.
Private key() As Byte = {1, 2, 3, 4, 5, 6, 7, 8}
Private iv() As Byte = {65, 110, 68, 26, 69, 178, 200, 219}
Dim plainText As String
plainText = "HelloWorldhjsl kajldalkdjlaksj dlakdja"
Dim DES As New System.Security .Cryptography.D ESCryptoService Provider
' Set the cipher mode.
DES.Mode = System.Security .Cryptography.C ipherMode.CBC
' Create the encryptor.
Dim DESEncrypt As System.Security .Cryptography.I CryptoTransform = DES.CreateEncry ptor(Me.key, Me.iv)
' Get a byte array of the string.
Dim Buffer As Byte() = System.Text.ASC IIEncoding.ASCI I.GetBytes(plai nText)
' Transform and return the string.
Dim keyout As String
keyout = Convert.ToBase6 4String(DESEncr ypt.TransformFi nalBlock(Buffer , 0, Buffer.Length))
Private key() As Byte = {1, 2, 3, 4, 5, 6, 7, 8}
Private iv() As Byte = {65, 110, 68, 26, 69, 178, 200, 219}
Dim plainText As String
plainText = "HelloWorldhjsl kajldalkdjlaksj dlakdja"
Dim DES As New System.Security .Cryptography.D ESCryptoService Provider
' Set the cipher mode.
DES.Mode = System.Security .Cryptography.C ipherMode.CBC
' Create the encryptor.
Dim DESEncrypt As System.Security .Cryptography.I CryptoTransform = DES.CreateEncry ptor(Me.key, Me.iv)
' Get a byte array of the string.
Dim Buffer As Byte() = System.Text.ASC IIEncoding.ASCI I.GetBytes(plai nText)
' Transform and return the string.
Dim keyout As String
keyout = Convert.ToBase6 4String(DESEncr ypt.TransformFi nalBlock(Buffer , 0, Buffer.Length))
Comment