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