---
schema_version: "1"
id: 087d43baa0a2f0942cef5d5286ae0d7beb93f94ad5cad89b2f41c146d0512f62
title: HMACBinary
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/latest/dw-crypto-functions-hmacbinary.md
canonical_url: https://docs.mulesoft.com/dataweave/latest/dw-crypto-functions-hmacbinary
source_site: docs.mulesoft.com
content_type: documentation
content_hash: d37ae835534ee9b1ba4973c6f209dabe94b51819755aca80d87841e782505ea5
description: MuleSoft Documentation Site
release: "2.13"
latest: true
---
---
product: DataWeave
version: 2.13
is-latest-version: true
---

# HMACBinary

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

## HMACBinary(secret: Binary, content: Binary, @CryptographicSink 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"
}
```
