ph_getsha256hash PowerHome formula function
Description
Calculates the SHA256 hash value for the
data specified by the
as_input parameter
Syntax
ph_getsha256hash ( as_input )
ph_getsha256hash ( as_input, ai_type )
Argument | Description |
as_input | String. The data to have the SHA256 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
SHA256 hash value for
the specified data
Usage
Use this function to calculate a SHA256 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_getsha256hash("This is a test",0) -
Returns a SHA256 hash value of C7BE1ED902FB8DD4D48997C6452F5D7E509FBCDBE2808B16BCF4EDCE4C07D14E