Help / WLanguage / WLanguage functions / Standard functions / Encryption/compression functions
  • 3DES encryption
EncryptStandard (Example)
3DES encryption
This example is used to perform a 3DES encryption in an URL.
// 3DES encryption used in an URL
// ----------------------------------------
bufEncryptedResult is Buffer
bufToEncrypt is Buffer = "Message to encrypt"
bufMD5Key is Buffer
bufKey is Buffer = "Encryption key"
// Hash the key using MD5
bufMD5Key = HashString(HA_MD5_128, bufKey)
// MD5 gives a result on 128 bits (16 bytes)
// Fills the encryption key on 192 bits (24 bytes)
// because 3DES requires 192-bit keys (3x64 bits)
// To do so, the first 64 bits must be repeated (first 8 bytes)
// from the beginning to the end of the key
bufMD5Key = bufMD5Key + bufMD5Key[[TO 8]]
// Encrypts in 3DES
bufEncryptedResult = EncryptStandard(bufToEncrypt, bufMD5Key, crypt3DES, ...
cryptCBC, cryptPaddingPKCS)
// Switches the result to base64 so that it can be read, without CR
bufEncryptedResult = Replace(Encrypt(bufEncryptedResult, "", ...
cryptNone, encodeBASE64), CR, "")
// Encodes all so that it can be passed on an URL to a site
sURLParameter is string = URLEncode(bufEncryptedResult)
Minimum version required
  • Version 20
This page is also available for…
Click [Add] to post a comment

Last update: 06/12/2023

Send a report | Local help