rekey example

# for (i = 0U; i < crypto_secretstream_xchacha20poly1305_INONCEBYTES; i++) {         # new_key_and_inonce[crypto_stream_chacha20_ietf_KEYBYTES + i] =         # STATE_INONCE(state)[i];         # }         $new_key_and_inonce .= ParagonIE_Sodium_Core_Util::substR($st->getNonce(), 0, 8);

        # crypto_stream_chacha20_ietf_xor(new_key_and_inonce, new_key_and_inonce,         # sizeof new_key_and_inonce,         # state->nonce, state->k);
        $st->rekey(ParagonIE_Sodium_Core_ChaCha20::ietfStreamXorIc(
            $new_key_and_inonce,
            $st->getCombinedNonce(),
            $st->getKey(),
            ParagonIE_Sodium_Core_Util::store64_le(0)
        ));

        # for (i = 0U; i < crypto_stream_chacha20_ietf_KEYBYTES; i++) {         # state->k[i] = new_key_and_inonce[i];         # }         # for (i = 0U; i < crypto_secretstream_xchacha20poly1305_INONCEBYTES; i++) {         # STATE_INONCE(state)[i] =
# for (i = 0U; i < crypto_secretstream_xchacha20poly1305_INONCEBYTES; i++) {         # new_key_and_inonce[crypto_stream_chacha20_ietf_KEYBYTES + i] =         # STATE_INONCE(state)[i];         # }         $new_key_and_inonce .= ParagonIE_Sodium_Core32_Util::substR($st->getNonce(), 0, 8);

        # crypto_stream_chacha20_ietf_xor(new_key_and_inonce, new_key_and_inonce,         # sizeof new_key_and_inonce,         # state->nonce, state->k);
        $st->rekey(ParagonIE_Sodium_Core32_ChaCha20::ietfStreamXorIc(
            $new_key_and_inonce,
            $st->getCombinedNonce(),
            $st->getKey(),
            ParagonIE_Sodium_Core32_Util::store64_le(0)
        ));

        # for (i = 0U; i < crypto_stream_chacha20_ietf_KEYBYTES; i++) {         # state->k[i] = new_key_and_inonce[i];         # }         # for (i = 0U; i < crypto_secretstream_xchacha20poly1305_INONCEBYTES; i++) {         # STATE_INONCE(state)[i] =
$item->setValue($value);
    return $this;
  }

  /** * {@inheritdoc} */
  public function removeItem($index) {
    if (isset($this->list) && array_key_exists($index$this->list)) {
      // Remove the item, and reassign deltas.       unset($this->list[$index]);
      $this->rekey($index);
    }
    else {
      throw new \InvalidArgumentException('Unable to remove item at non-existing index.');
    }
    return $this;
  }

  /** * Renumbers the items in the list. * * @param int $from_index * Optionally, the index at which to start the renumbering, if it is known * that items before that can safely be skipped (for example, when removing * an item at a given index). */
Home | Imprint | This part of the site doesn't use cookies.