---
schema_version: "1"
id: 9cb3cd2b733668a17cd8377ca007a893457a8f44a929239eec9d040d537e007d
title: hashWith
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.3/dw-crypto-functions-hashwith.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.3/dw-crypto-functions-hashwith
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 76a5fb0566774bcfef19c7a6e3131f9bf947e15713600c73585dc53bc52c4d40
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
# hashWith

## [](#hashwith1)hashWith(Binary, String): Binary

指定されたアルゴリズムを使用してバイナリコンテンツのハッシュ値を計算します。

最初の引数はハッシュ値の計算に使用するバイナリコンテンツを指定し、2 つ目の引数は使用するハッシュアルゴリズムを指定します。2 つ目の引数は、使用可能なアルゴリズム名にする必要があります。

<table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
</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>MD2</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://www.ietf.org/rfc/rfc1319.txt">RFC 1319</a>​ で定義される MD2 メッセージダイジェストアルゴリズム。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MD5</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://www.ietf.org/rfc/rfc1321.txt">RFC 1321</a>​ で定義される MD5 メッセージダイジェストアルゴリズム。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SHA-1</code>​、​<code>SHA-256</code>​、​<code>SHA-384</code>​、​<code>SHA-512</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://csrc.nist.gov/publications/fips/index.html">FIPS PUB 180-2</a>​ で定義されるハッシュアルゴリズム。SHA-256 は衝突攻撃に対する 128 ビットのセキュリティを提供するための 256 ビットハッシュ関数で、SHA-512 は 256 ビットのセキュリティを提供するための 512 ビットハッシュ関数です。384 ビットハッシュは、SHA-512 の出力を切り捨てることによって取得できます。</p></td>
</tr>
</tbody>
</table>

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

<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>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">​<code>content</code>​ のハッシュ値を計算するために使用するアルゴリズムの名前。この値は ​<code>String</code>​ です。デフォルトは ​<code>SHA-1</code>​ です。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、MD2 アルゴリズムを使用してバイナリ値を暗号化します。

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

```DataWeave
%dw 2.0
import dw::Crypto
output application/json
---
{ "md2" : Crypto::hashWith("hello" as Binary, "MD2") }
```

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

```JSON
{ "md2": "\ufffd\u0004ls\ufffd\u00031\ufffdh\ufffd}8\u0004\ufffd\u0006U" }
```