---
schema_version: "1"
id: fbb73f4bfe0edf782c9fe8d5f74233d1142c08750c2cc540296e6dcc2badfb9b
title: HMACWith
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.5/dw-crypto-functions-hmacwith.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.5/dw-crypto-functions-hmacwith
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 62c20b865c811c94ca891818142f5b2f5a653c471127b5d23a5fbb67e9b20b59
description: MuleSoft Documentation Site
release: "2.5"
latest: false
---
# HMACWith

## [](#hmacwith1)HMACWith(secret: Binary, content: Binary, @Since(version = "2.2.0") algorithm: String = "HmacSHA1"): String

入力コンテンツの HMAC ハッシュを計算し (秘密暗号化キーを使用)、その結果を小文字の 16 進文字列に変換します。

`HMACBinary`​ も参照してください。

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>secret</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content</code>​ を暗号化するときに使用される秘密暗号化キー (バイナリ値)。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">バイナリ入力値。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>algorithm</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">(​<em>DataWeave 2.2.0 で導入されました。Mule 4.2 以降でサポートされます。</em>​) ハッシュアルゴリズム。デフォルトでは、​<code>HmacSHA1</code>​ が使用されます。他の有効な値は、​<code>HmacSHA256</code>​ と ​<code>HmacSHA512</code>​ です。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、HMAC と秘密値を使用して入力コンテンツを暗号化します。アルゴリズムには ​`HmacSHA256`​ を使用します。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import dw::Crypto
output application/json
---
{ "HMACWith" : Crypto::HMACWith("secret_key" as Binary, "Some value to hash" as Binary, "HmacSHA256") }
```

#### [](#出力)出力

```JSON
{ "HMACWith": "b51b4fe8c4e37304605753272b5b4321f9644a9b09cb1179d7016c25041d1747" }
```