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

# HMACBinary

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

## HMACBinary(Binary, Binary, String): 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><p>The secret cryptographic key (a <code>Binary</code>) used when encrypting the <code>content</code>).</p></td></tr><tr><td><p><code>content</code></p></td><td><p>The input content, a <code>Binary</code> value.</p></td></tr><tr><td><p><code>algorithm</code></p></td><td><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></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": "^\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"
}
```
