Contact Us 1-800-596-4880

HMACBinary

HMACBinary(Binary, Binary, String): Binary

Computes an HMAC hash (with a secret cryptographic key) on input content.

See also, HMACWith.

Parameters

Name Description

secret

The secret cryptographic key (a Binary) used when encrypting the content).

content

The input content, a Binary value.

algorithm

The hashing algorithm. HmacSHA1 is the default. Valid values depend on the JDK version you are using. For JDK 8 and JDK 11, HmacMD5, HmacSHA1, HmacSHA224, HmacSHA256, HmacSHA384, and HmacSHA512 are valid algorithms. For JDK 11, HmacSHA512/224 and HmacSHA512/256 are also valid.

Example

This example uses HMAC with a secret value to encrypt the input content.

Source

%dw 2.0
import dw::Crypto
output application/json
---
{
  "HMACBinary" : Crypto::HMACBinary("confidential" as Binary, "xxxxx" as Binary, "HmacSHA512")
}

Output

{
  "HMACBinary": "^\tXƐ\f\ufffd\ufffd\ufffdӞ]\ufffdd\ufffd\ufffd\u001b\u0003\ufffd\tL\ufffd\ufffdr#\ufffd\ufffdc\ufffd\u001bl\ufffd-q\ufffd\u001bؐ+\ufffd\u001d*M\ufffdz\ufffd\u0012&\ufffd&\ufffd\ufffdd\ufffd\ufffd̷R\u0003qO\ufffdF"
}