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

# 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"
}
```
