AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de cifrado/compresión
  • 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)
Versión mínima requerida
  • Versión 20
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 12/06/2023

Señalar un error o enviar una sugerencia | Ayuda local