Encrypt3DES Function

Action

Encrypts string or binary data into a printable format using the Triple Data Encryption Algorithm (Triple DES) block cipher. This function is useful for encrypting passwords and other sensitive data.

Include file

kernel.bdh

Syntax

Encrypt3DES( in sData : string,
             in sKey1 : string optional, 
             in sKey2 : string optional,
             in sKey3 : string optional ): string;

Return value

  • encrypted string

Parameter Description
sData String or binary data to be encrypted
sKey1 String or binary data used as first encryption key (optional).
sKey2 String or binary data used as second encryption key (optional).
sKey3 String or binary data used as third encryption key (optional).
注: The returned string is about 30% larger in size than the original data.

Example

dcltrans
  transaction TMain
  var
    sUserPass  : string;
    sEncrypted : string;
  begin
    // Build your own authentication header
    AttributeGetString("Password", sUserPass);
    sEncrypted := Encrypt3DES(sUserPass);
    Print(sEncrypted);
    sUserPass := Decrypt3DES(sEncrypted);
    Print("decrypted password: " + sUserPass);
  end TMain;