DataWeave 2.2 is compatible and bundled with Mule 4.2. Standard Support for Mule 4.2 ended on May 2, 2021, and this version of Mule will reach its End of Life on May 2, 2023, when Extended Support ends.

Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted.

MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements.

HMACBinary(Binary, Binary, String): Binary

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

See also, HMACWith.


Name Description


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


The input content, a Binary value.


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.


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


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


  "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"

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub
Submit your feedback!
Share your thoughts to help us build the best documentation experience for you!
Take our latest survey!