<?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-secretstream-xchacha20poly1305-pull.php',
    1 => 'sodium_crypto_secretstream_xchacha20poly1305_pull',
    2 => 'Decrypt a chunk of data from an encrypted stream',
  ),
  'up' => 
  array (
    0 => 'ref.sodium.php',
    1 => 'Sodium 函数',
  ),
  'prev' => 
  array (
    0 => 'function.sodium-crypto-secretstream-xchacha20poly1305-keygen.php',
    1 => 'sodium_crypto_secretstream_xchacha20poly1305_keygen',
  ),
  'next' => 
  array (
    0 => 'function.sodium-crypto-secretstream-xchacha20poly1305-push.php',
    1 => 'sodium_crypto_secretstream_xchacha20poly1305_push',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/sodium/functions/sodium-crypto-secretstream-xchacha20poly1305-pull.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.sodium-crypto-secretstream-xchacha20poly1305-pull" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sodium_crypto_secretstream_xchacha20poly1305_pull</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.2.0, PHP 8)</p><p class="refpurpose"><span class="refname">sodium_crypto_secretstream_xchacha20poly1305_pull</span> &mdash; <span class="dc-title">Decrypt a chunk of data from an encrypted stream</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sodium-crypto-secretstream-xchacha20poly1305-pull-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>sodium_crypto_secretstream_xchacha20poly1305_pull</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter reference">&$state</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$ciphertext</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$additional_data</code><span class="initializer"> = &quot;&quot;</span></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="simpara">
   Decrypt a chunk of data from an encrypted stream.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.sodium-crypto-secretstream-xchacha20poly1305-pull-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">state</code></dt>
    <dd>
     <span class="simpara">
      See <span class="function"><a href="function.sodium-crypto-secretstream-xchacha20poly1305-init-pull.php" class="function">sodium_crypto_secretstream_xchacha20poly1305_init_pull()</a></span>
      and <span class="function"><a href="function.sodium-crypto-secretstream-xchacha20poly1305-init-push.php" class="function">sodium_crypto_secretstream_xchacha20poly1305_init_push()</a></span>
     </span>
    </dd>
   
   
    <dt><code class="parameter">ciphertext</code></dt>
    <dd>
     <span class="simpara">
      The ciphertext chunk to decrypt.
     </span>
    </dd>
   
   
    <dt><code class="parameter">additional_data</code></dt>
    <dd>
     <span class="simpara">
      Optional additional data to include in the authentication tag.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sodium-crypto-secretstream-xchacha20poly1305-pull-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   An array with two values:
   <ul class="itemizedlist">
    <li class="listitem">
     <span class="simpara">
      <span class="type"><a href="language.types.string.php" class="type string">string</a></span>; The decrypted chunk
     </span>
    </li>
    <li class="listitem">
     <p class="para">
      <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>; An optional tag (if provided during push). Possible values:
      <ul class="simplelist">
       <li>
        <strong><code><a href="sodium.constants.php#constant.sodium-crypto-secretstream-xchacha20poly1305-tag-message">SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE</a></code></strong>:
        the most common tag, that doesn't add any information about the nature of the message.
       </li>
       <li>
        <strong><code><a href="sodium.constants.php#constant.sodium-crypto-secretstream-xchacha20poly1305-tag-final">SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL</a></code></strong>:
        indicates that the message marks the end of the stream, and erases the secret key used to encrypt the previous sequence.
       </li>
       <li>
        <strong><code><a href="sodium.constants.php#constant.sodium-crypto-secretstream-xchacha20poly1305-tag-push">SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH</a></code></strong>:
        indicates that the message marks the end of a set of messages, but not the end of the stream.
        For example, a huge JSON string sent as multiple chunks can use this tag to indicate to the application that the
        string is complete and that it can be decoded. But the stream itself is not closed, and more data may follow.
       </li>
       <li>
        <strong><code><a href="sodium.constants.php#constant.sodium-crypto-secretstream-xchacha20poly1305-tag-rekey">SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY</a></code></strong>:
        "forget" the key used to encrypt this message and the previous ones, and derive a new secret key.
       </li>
      </ul>
     </p>
    </li>
   </ul>
  </p>
 </div>


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