Decode

(System Library)

Description: Returns the plain value of a cipher that is the result of the Encode function.
Returns: String
Usage: Script Only.
Function Groups: Encryption
Related to: Encode | BlockDecrypt | Base64Decode | Hash | Unpack
Format: System.Decode(CipherValue[, UnpackDictionary, Key, HashKey, pError]);
Parameters:  
CipherValue
Required. The information to be decoded.
UnpackDictionary
If a dictionary was used to pack the information as part of the encoding, the mirror of that dictionary must be provided to unpack the information.
See notes and example in the Unpack function.
Key
Optional string. Must be included if the CipherValue was encrypted using a key, in which case this value must match the key that was used in the Encode function.
HashKey
Optional string. Must be included if the CipherValue was protected from tampering with a Hash value, in which case this value must match the Hash that was used in the Encode function.
pError

Optional. If present, will return a numeric value from the module providing extra information if the decode operation fails. Possible values and meanings for pError follow:

0 No error
1 Invalid Opcode
2 Hashed CipherText, missing HashKey parameter
3 Encrypted CipherText, missing Key parameter
4 Error in Salt Length
5 Error in Decompressed Length
6 Error in Base64 Encoding
7 Error in Salt Length
8 Hash does not match payload
9 Error when Decrypting payload
10 Error when Decompressing payload
Comments:

Decode will check for errors at every step in the operation and will skip subsequent steps should an error occur.

Examples:

  If Watch(1);
  [
    Secret = System.Encode("Hello");
    NotSecret = System.Decode(Secret);
  ]