Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
2-Key Triple DESDemonstrates 2-Key Triple DES encryption (112-bit 3DES encryption).
LOCAL loCrypt LOCAL lnSuccess LOCAL lcKeyHex LOCAL lcEncStr LOCAL lcDecStr loCrypt = CreateObject('Chilkat.Crypt2') lnSuccess = loCrypt.UnlockComponent("Anything for 30-day trial.") IF (lnSuccess <> 1) THEN =MESSAGEBOX("Crypt component unlock failed") QUIT ENDIF * Specify 3DES for the encryption algorithm: loCrypt.CryptAlgorithm = "3des" loCrypt.CipherMode = "ecb" * For 2-Key Triple-DES, use a key length of 128 * (Given that each byte's msb is a parity bit, the strength is really 112 bits). loCrypt.KeyLength = 128 * Pad with zeros loCrypt.PaddingScheme = 3 * EncodingMode specifies the encoding of the output for * encryption, and the input for decryption. * It may be "hex", "url", "base64", or "quoted-printable". loCrypt.EncodingMode = "hex" * Let's create a secret key by using the MD5 hash of a password. * The Digest-MD5 algorithm produces a 16-byte hash (i.e. 128 bits) loCrypt.HashAlgorithm = "md5" lcKeyHex = loCrypt.HashStringENC("secretPassword") * Set the encryption key: loCrypt.SetEncodedKey(lcKeyHex,"hex") * Encrypt lcEncStr = loCrypt.EncryptStringENC("The quick brown fox jumped over the lazy dog") =MESSAGEBOX(lcEncStr) * Now decrypt: lcDecStr = loCrypt.DecryptStringENC(lcEncStr) =MESSAGEBOX(lcDecStr) |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser