hmacsha256

HMAC-SHA256

Description

The zoho.encryption.hmacsha256 task returns the hash corresponding to the given text generated using the HMAC-SHA256 algorithm.

Syntax

<response> = zoho.encryption.hmacsha256(<key>, <data>, <output_type>);

where:

ParamsData typeDescription

<response>

TEXT

The hash generated using HMAC-SHA256 algorithm.

<key>

TEXT

The secret key with which the hash needs to be generated.

<data>

TEXT

The source text whose corresponding hash needs to be computed.

<output_type>

TEXT

The type in which the generated hash needs to be represented. By default, the output type is base64.

Allowed values:

  • hex - returns the hash in hexadecimal format

Example 1: Generate hash in base64 format using the HMAC-SHA256 algorithm

The following script returns the hash generated using the HMAC-SHA256 algorithm for the text - My#New#Password with the key - Use me to generate hash in base64 format:

response = zoho.encryption.hmacsha256("Use me to generate hash", "My#New#Password");

where:

response
The TEXT that represents the hash value returned by this task. Here, the hash returned is edYCyxkU4jL2dEjEDO8aUy8WZrpKRvQquNpgKUqe5vA=.
"Use me to generate hash"
The TEXT that represents the secret key with which the hash is generated.
"My#New#Password"
The TEXT that represents the source text whose corresponding hash needs to be computed.

Example 2: Generate hash in hexadecimal format using the HMAC-SHA256 algorithm

The following script returns the hash generated using the HMAC-SHA256 algorithm for the text - My#New#Password with the key - Use me to generate hash in hexadecimal format:

response = zoho.encryption.hmacsha256("Use me to generate hash", "My#New#Password", "hex");

where:

response
The TEXT that represents the hash value returned by this task. Here, the hash returned is 79d602cb1914e232f67448c40cef1a532f1666ba4a46f42ab8da60294a9ee6f0.
"hex"
The TEXT that represents the output type of the hash. Here, the hash is represented in hexadecimal format.

Related Links

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com