---
schema_version: "1"
id: 7d7c17181414cad28c925f14d67a03ab4f45f0647f1a44b7def8a10f41c6415b
title: HMACBinary
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.4/dw-crypto-functions-hmacbinary.md
canonical_url: https://docs.mulesoft.com/dataweave/2.4/dw-crypto-functions-hmacbinary
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 18724c45dfff1eec0a0558535f88173afa790f0eae79a6d9c9539b14534894a2
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
---
product: DataWeave
version: 2.4
---

# HMACBinary

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## HMACBinary(secret: Binary, content: Binary, algorithm: String = "HmacSHA1"): Binary

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

See also, `HMACWith`.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>secret</code></p></td><td><div><div><p>The secret cryptographic key (a binary value) used when encrypting the <code>content</code>.</p></div></div></td></tr><tr><td><p><code>content</code></p></td><td><div><div><p>The binary input value.</p></div></div></td></tr><tr><td><p><code>algorithm</code></p></td><td><div><div><p>The hashing algorithm. <code>HmacSHA1</code> is the default. Valid values depend on the JDK version you are using. For JDK 8 and JDK 11, <code>HmacMD5</code>, <code>HmacSHA1</code>, <code>HmacSHA224</code>, <code>HmacSHA256</code>, <code>HmacSHA384</code>, and <code>HmacSHA512</code> are valid algorithms. For JDK 11, <code>HmacSHA512/224</code> and <code>HmacSHA512/256</code> are also valid.</p></div></div></td></tr></tbody></table>

### Example

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

#### Source

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

#### Output

```JSON
{
  "HMACBinary": "\ufffd\ufffd\ufffd\ufffd^h\ufffd!3\u0005\ufffd֎\u00017\ufffd\ufffd\ufffd`\ufffd8?\ufffdjn7\ufffdbs;\t\ufffdƅ\ufffd\ufffd\ufffdx&g\ufffd~\ufffd\ufffd%\ufffd7>1\ufffdK\u000e@\ufffdC\u0011\ufffdT\ufffd}W"
}
```
