<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.sodium.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.sodium-crypto-generichash.php',
    1 => 'sodium_crypto_generichash',
    2 => 'Get a hash of the message',
  ),
  'up' => 
  array (
    0 => 'ref.sodium.php',
    1 => 'Sodium 函数',
  ),
  'prev' => 
  array (
    0 => 'function.sodium-crypto-core-ristretto255-sub.php',
    1 => 'sodium_crypto_core_ristretto255_sub',
  ),
  'next' => 
  array (
    0 => 'function.sodium-crypto-generichash-final.php',
    1 => 'sodium_crypto_generichash_final',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/sodium/functions/sodium-crypto-generichash.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.sodium-crypto-generichash" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sodium_crypto_generichash</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.2.0, PHP 8)</p><p class="refpurpose"><span class="refname">sodium_crypto_generichash</span> &mdash; <span class="dc-title">Get a hash of the message</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sodium-crypto-generichash-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>sodium_crypto_generichash</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$message</code></span>, <span class="methodparam"><span class="attribute"><a href="class.sensitiveparameter.php">#[\SensitiveParameter]</a> </span><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$key</code><span class="initializer"> = &quot;&quot;</span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$length</code><span class="initializer"> = <strong><code><a href="sodium.constants.php#constant.sodium-crypto-generichash-bytes">SODIUM_CRYPTO_GENERICHASH_BYTES</a></code></strong></span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Hash a message with BLAKE2b.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.sodium-crypto-generichash-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">message</code></dt>
    <dd>
     <p class="para">
      The message being hashed.
     </p>
    </dd>
   
   
    <dt><code class="parameter">key</code></dt>
    <dd>
     <p class="para">
      (Optional) cryptographic key. This serves the same function as a HMAC key, but it&#039;s
      utilized as a reserved section of the internal BLAKE2 state.
     </p>
    </dd>
   
   
    <dt><code class="parameter">length</code></dt>
    <dd>
     <p class="para">
      Output size.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sodium-crypto-generichash-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The cryptographic hash as raw bytes. If a hex-encoded output is desired,
   the result can be passed to <span class="function"><a href="function.sodium-bin2hex.php" class="function">sodium_bin2hex()</a></span>.
  </p>
 </div>



</div><?php manual_footer($setup); ?>