ph_getmd5hash PowerHome formula function
Description
Calculates the MD5 hash value for the data specified by the as_input parameter
Syntax
ph_getmd5hash ( as_input )
ph_getmd5hash ( as_input, ai_type )
Argument Description
as_input String. The data to have the MD5 hash calcuated for. Depending upon the ai_type parameter, this value can be either a direct string, a hex encoded string, or a full path and filename of a file to hash
ai_type Integer (Optional). Determines how to interpret the data supplied in the as_input parameter. Valid values are 0, 1, 2, and 3. See Usage below for details. If this parameter is not supplied, a value of 0 will be assumed
Return value
String. Returns the calculated MD5 hash value for the specified data
Usage
Use this function to calculate an MD5 hash for strings or files. The hash is done using the standard routines available in C#. The ai_type parameter specifies how to interpret the data in the as_input parameter. An ai_type value of 0 will interpret the data in as_input as a string of ASCII bytes. An ai_type value of 1 will interpret the data as a string of UTF8 bytes. An ai_type value of 2 expects the data in as_input to be a hex encoded string (such as the output of the s2h( ) function). The function will first decode the hex string to their actual byte values and then perform the hash on the byte array. An ai_type value of 3 expects as_input to contain a full path and filename that you wish to hash.
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_getmd5hash("Test") - This example will return the following string: 0CBC6611F5540BD0809A388DC95A615B