TripleDES Encryption Example

TripleDES encryption is the default for encryption and the simplest way to use it is by omitting most of the parameters:

DO wwEncryption

LOCAL loEnc as wwEncryption
loEnc = CREATEOBJECT("wwEncryption")

lcOrig = "Hello World"
? lcOrig

lcKey = "12345678901234567890123456789012"
? lcKey
? LEN(lcKey)

lcVal  = loEnc.EncryptString(lcOrig, lcKey)
? lcVal

lcOrig  = loEnc.DecryptString(lcVal, lcKey)
? lcOrig

The defaults use:

  • TripleDES Encryption
  • ECB Cipher
  • MD5 Key Hashing

This is equivalent to using:

lcVal  = loEnc.EncryptString(lcOrig, lcKey, .F., "TripleDES", "ECB", "MD5")
? lcVal

lcOrig  = loEnc.DecryptString(lcVal, lcKey, .F., "TripleDES", "ECB", "MD5")
? lcOrig

© West Wind Technologies, 1996-2021 • Updated: 08/14/21
Comment or report problem with topic