You are here

public static function ParagonIE_Sodium_Crypto::aead_xchacha20poly1305_ietf_encrypt in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/paragonie/sodium_compat/src/Crypto.php \ParagonIE_Sodium_Crypto::aead_xchacha20poly1305_ietf_encrypt()

AEAD Encryption with ChaCha20-Poly1305, IETF mode (96-bit nonce)

@internal Do not use this directly. Use ParagonIE_Sodium_Compat.

Parameters

string $message:

string $ad:

string $nonce:

string $key:

Return value

string

Throws

SodiumException

TypeError

1 call to ParagonIE_Sodium_Crypto::aead_xchacha20poly1305_ietf_encrypt()
ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt in vendor/paragonie/sodium_compat/src/Compat.php
Authenticated Encryption with Associated Data

File

vendor/paragonie/sodium_compat/src/Crypto.php, line 358

Class

ParagonIE_Sodium_Crypto
Class ParagonIE_Sodium_Crypto

Code

public static function aead_xchacha20poly1305_ietf_encrypt($message = '', $ad = '', $nonce = '', $key = '') {
  $subkey = ParagonIE_Sodium_Core_HChaCha20::hChaCha20(ParagonIE_Sodium_Core_Util::substr($nonce, 0, 16), $key);
  $nonceLast = "\0\0\0\0" . ParagonIE_Sodium_Core_Util::substr($nonce, 16, 8);
  return self::aead_chacha20poly1305_ietf_encrypt($message, $ad, $nonceLast, $subkey);
}