SHA256digest (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (→‎See also: typo)
m (→‎Examples: typo)
Line 22: Line 22:
==Examples==
==Examples==
The 32-byte SHA-256 hash of a string is typically expressed as a 64-digit hex value. In the following example, the output string from the <var>SHA256digest</var> method is converted to hex using the <var>[[StringToHex (String function)|StringToHex]]</var> intrinsic method:
The 32-byte SHA-256 hash of a string is typically expressed as a 64-digit hex value. In the following example, the output string from the <var>SHA256digest</var> method is converted to hex using the <var>[[StringToHex (String function)|StringToHex]]</var> intrinsic method:
<p class="code">[[PrintText statement|printText]] {'testing':shadigest:stringtohex}
<p class="code">[[PrintText statement|printText]] {'testing':sha256digest:stringtohex}
</p>
</p>
The result is:
The result is:

Revision as of 16:12, 1 September 2015

256-bit SHA-2 digest (String class)

[Introduced in Model 204 7.6]


The SHA256digest intrinsic function returns the 32-byte (always) binary string that is the SHA-256 digest of the method object string.

Syntax

%outString = string:SHA256digest

Syntax terms

%outString A string variable to receive the SHA-256 digest of the method object string.
string The string to which the method is applied.

Usage notes

Examples

The 32-byte SHA-256 hash of a string is typically expressed as a 64-digit hex value. In the following example, the output string from the SHA256digest method is converted to hex using the StringToHex intrinsic method:

printText {'testing':sha256digest:stringtohex}

The result is:

365B9CF22DF4D98F00DC41325B822E1FF2872FB046C09BF5669404850EA0BE0B

See also