[VB6 equivalent: DES_HexMode]
Dim strOutput As String Dim strInput As String Dim strKey As String Dim strIV As String Dim sCorrect As String ' "Now is the time for all " in hex strInput = "4e6f77206973207468652074696d6520666f7220616c6c20" strKey = "0123456789abcdef" strIV = "1234567890abcdef" sCorrect = "e5c7cdde872bf27c43e934008c389c0f683788499a7c05f6" ' Set strOutput to be same length as strInput Console.WriteLine("KY=" & " " & strKey) Console.WriteLine("IV=" & " " & strIV) Console.WriteLine("PT=" & " " & strInput) ' Encrypt in one-off process strOutput = Des.Encrypt(strInput, strKey, Mode.CBC, strIV) Console.WriteLine("CT=" & " " & strOutput) Console.WriteLine("OK=" & " " & sCorrect) ' Now decrypt back to plain text strInput = strOutput strOutput = Des.Decrypt(strInput, strKey, Mode.CBC, strIV) Console.WriteLine("P'=" & " " & strOutput)
See Also:
Des.Decrypt Method (String, String, Mode, String)
Des.Encrypt Method (String, String, Mode, String)