AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de cifrado/compresión
  • Encrypting and decrypting an external file
  • Decrypting a stream in base64binary format
  • Encryption in PHP
  • Encryption in Android/Java and decryption by a WINDEV application (or conversely)
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Advertencia
A partir de la versión 24, Uncrypt se conserva por motivos de compatibilidad. Esta función ha sido reemplazada por Decrypt.
Decrypts a character string that was encrypted by Encrypt.
Note If encryption and decryption are performed on different platforms (e.g. encryption on Android and decryption on Windows), use the functions EncryptStandard and DecryptStandard. For more details, refer to the "Remarks" paragraph.
// Encrypt a string
ResEncrypt = Encrypt("The number of my bank account in Switzerland is 74538290", "Password")
...
// Decrypt the string
Res = Decrypt(ResEncrypt, "Password")
// Decode the data encoded in base 64
bufDecode is Buffer = Decrypt(bufBase64, "", crypteNone, encodeBASE64)
Sintaxis
<Result> = Decrypt(<Encrypted string> , <Password> [, <Type of encryption used> [, <Format of encrypted string>]])
<Result>: Character string
  • Decrypted character string,
  • Empty string ("") if an error occurred. To get more details on the error, use ErrorInfo.
<Encrypted string>: Character string
Encrypted character string. This character string was encrypted by Encrypt.
<Password>: Character string
Password used to decrypt the character string. This password must be identical to the password that was used to encrypt the character string. A long password provides better encryption security.
<Type of encryption used>: Optional constant (or combination of constants)
Specifies the type of encryption and compression performed. This parameter must be identical to the one specified during the encryption.
  • Type of encryption:
    cryptAnsiThis constant can only be used in WINDEV Mobile for Windows CE.
    The encryption is identical to the one performed in a WINDEV or WEBDEV application.
    Useful for the applications that encrypt in WINDEV Mobile and that decrypt in WINDEV for example.
    To use this constant, <Format of encrypted string> must be set to True.
    cryptFast
    (Default value)
    Priority was given to the encryption speed (algorithm on 128 bits).
    Java The algorithm used will be a Blowfish algorithm.
    AndroidWidget Android This constant is not supported.
    PHP The algorithm used will be a Blowfish algorithm with 16 rounds.
    cryptNoneNo encryption was performed.
    cryptRC516Priority was given to the encryption security (RC5 algorithm on 16 rounds).
    AndroidWidget Android JavaPHP This constant has no effect.
    cryptSecurePriority was given to the encryption security (RC5 algorithm on 128 bits).
    AndroidWidget Android Java The algorithm used will be a PBE algorithm (Password Based Encryption).
    PHP The algorithm used will be a 128-bit RINJDAEL algorithm.
  • Type of compression:
    compressLZWThe string is compressed before it is encrypted.
    AndroidWidget Android JavaPHP This constant has no effect.
    compressNone
    (Default value)
    No compression is performed.
    AndroidWidget Android JavaPHP This constant has no effect.
    compressShortStringThe string is compressed via an algorithm optimized for the short character strings. This compression will be effective only if the cryptNone constant is selected and if <Format of encrypted string> corresponds to the encodeNone constant.
    AndroidWidget Android JavaPHP This constant has no effect.
<Format of encrypted string>: Optional Integer constant
Indicates the format of the encrypted string. This parameter must be identical to the one specified during the encryption.
encodeBASE64BASE 64 format. The encrypted file contains printable characters only.
To decode a buffer in base 64, you also have the ability to use Decode associated with the encodeBASE64 constant.
encodeNone or FalseBinary format. The encrypted file may contain non-printable characters.
encodePCS or True
(Default value)
ASCII format. The encrypted file contains printable characters only.
encodeUUEncodeUUEncode format. The encrypted file contains printable characters only.
AndroidWidget Android Java This parameter is ignored.
Observaciones

Encrypting and decrypting an external file

To encrypt/decrypt an external file, use fEncrypt and fDecrypt.

Decrypting a stream in base64binary format

To decrypt a string encrypted in base64, you must use:
ResultString = Decrypt(EncryptedString, "", cryptNone, encodeBASE64)
// or
ResultString = Decrypt(EncryptedString, encodeBASE64)
PHP

Encryption in PHP

In PHP, the BlowFish encryption (cryptFast constant) and the RINJDAEL encryption (cryptSecure constant) are based on the MCrypt library. This library is commonly used by the PHP hosting providers and therefore it is always enabled. This library can be downloaded from the PHP site.
To enable (if necessary) this library locally, the following elements are required:
  • PHP installed.
  • the PHP.INI file found in the Windows directory must include the "extension=php_mcrypt.dll" line.
  • the php_mcrypt.dll file must exist in the directory of PHP extensions. This directory is defined in the PHP.INI file by the "extension_dir" variable.
AndroidJava

Encryption in Android/Java and decryption by a WINDEV application (or conversely)

Warning: the encryption/decryption algorithms used in Java and Android are not the same as those used by WINDEV. Therefore, you cannot encrypt a character string in Java or Android and decrypt it with WINDEV and vice versa.
To encrypt a character string in Java or Android and to decrypt it with WINDEV (or conversely), use EncryptStandard and DecryptStandard.
Componente: wd300std.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Exemplo com Fonte
https://repository.windev.com/resource.awp?file_id=281474976711928;exemplo-cryptografia-descryptografia
Boller
15 03 2024
LINK Exemplos
https://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/4235-comandos-criptografia-descriptografia-para-usar-windev-webdev-windev/read.awp
Boller
15 03 2024

Última modificación: 25/03/2025

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