Home Search

DriveWorks Pro 21
SppHashHMACSHA256UsingHexKey

Send Feedback

SppHashHMACSHA256UsingHexKey

Hashes a value using a hexadecimal encoded key using the SHA256 algorithm and returns it as a Base64 encoded string unless otherwise specified.

This function takes the Key, which must be in the format of a hexadecimal string (no delimiter), and a Value as plain text.

The result is returned as a Base64 encoded string (matching the function HashHMACSHA256).

The optional Output as Hexadecimal argument allows the format of the result to be specified.

Syntax

SppHashHMACSHA256UsingHexKey([Key], [Value], [Output as Hexadecimal])

Where:

Key should be in the format of a hexadecimal string and is the signing key to use during encryption.

Value is the base string to encrypt.

Output as Hexadecimal (optional) set to TRUE to output the result as a hexadecimal string, otherwise FALSE (default when not specified) for the result to be a Base64 encoded string.

Example

RuleResultMeaning
SppHashHMACSHA256UsingHexKey("736563726574206B6579", "little brown fox")SbLs1OSlFT90B01HOdFVt/Y7tJT2E/MDwUnM41stKjk=The string “little brown fox” has been hashed using the algorithm SHA256, with a key in the format of a hexadecimal string.
SppHashHMACSHA256UsingHexKey(HexFromString("MySecret"), "little brown fox", TRUE)52-A6-2B-60-7C-D5-D1-54-78-F2-B6-21-41-6D-98-99-F4-FD-FB-D7-34-3A-28-81-70-04-11-54-8C-F8-94-89The string "little brown fox" has been hashed using the algorithm SHA256, with the key "MySecret" formatted as a hexadecimal string.

The value is returned as a hexadecimal.

Information

The function HexFromString converts a string to hexadecimal.