Crypto
Use the Crypto commands to encode and decode ASCII text strings to and from Base64, as well as obtain CRC16, HMAC, and MD5 values for specified strings.
Compute the Base64 of a specified string.
Syntax
Crypto.Base64Encode('value', [pad])
Arguments
value : The value, enclosed within quotes, to encode to Base64.
pad : (Optional) Replace with true | false. If true, output is padded with '=' signs. The default is true.
Examples
print (Crypto.Base64Encode('Hello there'))
Debug Output
SGVsbG8gdGhlcmU=
print (Crypto.Base64Encode('Hello there',false))
Debug Output
SGVsbG8gdGhlcmU
Convert the Base64 of a specified value to a string.
Syntax
Crypto.Base64Decode('value')
Arguments
value : The value, enclosed within quotes, to decode from Base64.
Example
print (Crypto.Base64Decode('SGVsbG8gdGhlcmU='))
Debug Output
Hello there
Compute the CRC16 of a specified value.
Syntax
Crypto.CRC16Compute( 'value' )
Arguments
value : The value, enclosed within quotes, used to generate the CRC16.
Example
Crypto.CRC16Compute('Hello there')
Compute the message digest of specified data using a specified hashing algorithm.
Syntax
Crypto.Digest('algorithm', 'data')
Arguments
algorithm : Replace with md5 | sha1 | sha256 | sha512 , enclosed within quotes.
data : The data for which to compute the message authentication code, enclosed within quotes.
Example
Crypto.Digest('md5','Hello there')
Compute the message authentication code of specified data using a specified hashing algorithm and key.
Syntax
Crypto.HMAC('algorithm', 'key', 'data')
Arguments
algorithm : Replace with md5 | sha1 | sha256 | sha512 , enclosed within quotes.
key : The secret key to use for computing the message authentication code, enclosed within quotes.
data : The data for which to compute the message authentication code, enclosed within quotes.
Example
Crypto.HMAC('md5','123456789','Hello there')
Compute the MD5 hash of a specified value.
Syntax
Crypto.MD5Compute( 'value' )
Arguments
value : The value for which to compute the MD5 hash.
Example
print (Crypto.MD5Compute('Hello there'))
Debug Output
e8ea7a8d1e93e8764a84a0f3df4644de