[VB6 equivalent: CIPHER_Hex]
Dim nRet As Integer Dim sPlain As String Dim sCipher As String Dim sCheck As String Dim sKey As String Dim sInitV As String Dim sCorrect As String sPlain = "5468697320736F6D652073616D706520636F6E74656E742E0808080808080808" ' T h i s _ s o m e _ s a m p e _ c o n t e n t .(+padding 8 x 08) sKey = "737C791F25EAD0E04629254352F7DC6291E5CB26917ADA32" sInitV = "B36B6BFB6231084E" sCorrect = "d76fd1178fbd02f84231f5c1d2a2f74a4159482964f675248254223daf9af8e4" Console.WriteLine("KY=" & sKey) Console.WriteLine("PT=" & sPlain) ' Encrypt sCipher = Cipher.Encrypt(sPlain, sKey, sInitV, CipherAlgorithm.Tdea, Mode.CBC) Console.WriteLine("CT=" & sCipher & " " & nRet) Console.WriteLine("OK=" & sCorrect) ' Decrypt sCheck = Cipher.Decrypt(sCipher, sKey, sInitV, CipherAlgorithm.Tdea, Mode.CBC) Console.WriteLine("P'=" & sCheck & " " & nRet)
See Also:
Cipher.Decrypt Method (String, String, String, CipherAlgorithm, Mode)
Cipher.Encrypt Method (String, String, String, CipherAlgorithm, Mode)