desEncrypt()
The function encodes the content of a string or blob variable using the DES algorithm.
Synopsis
int desEncrypt (string | blob src, string key, blob &dest);
Parameters
Parameter | Description |
---|---|
src | The source variable as a string or blob. |
key | The key for the decoding. |
dest | The target variable. Contains the encoded variable. |
Return Value
In case of errors, the function returns -1 and otherwise the length of the encoded data.
Description
The function encodes the content of a string or blob variable using the DES algorithm and can be used together with the function "desDecrypt" for the encoding and decoding of string or blob variables.
Example
In the following example a string variable is encoded and decoded.
#uses "CtrlCrypt"
main()
{
string sFile = "ThisIsAWord";
string KKEy = "MyKey";
blob desFi;
blob desFi1;
int rVal = desEncrypt(sFile, KKEy, desFi);
DebugN("The function desEncrypt was executed successfully and
the variable was encoded:", rVal, "DestParameter:", desFi);
int rVal1 = desDecrypt(desFi, KKEy, desFi1);
DebugN("The function desDecrypt was executed successfully and
the variable was decoded:", rVal1, "Content", desFi1);
}
Assignment
Miscellaneous functions
Availability
UI, CTRL