wppaste
WordPress

ParagonIE_Sodium_Crypto32

Source
wp-includes/sodium_compat/src/Crypto32.php:15
Class ParagonIE_Sodium_Crypto

Description

ATTENTION!

If you are using this library, you should be using ParagonIE_Sodium_Compat in your code, not this class.

Compatibility

WordPress
core
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Methods · 41

Source code

abstract class ParagonIE_Sodium_Crypto32{    const aead_chacha20poly1305_KEYBYTES = 32;    const aead_chacha20poly1305_NSECBYTES = 0;    const aead_chacha20poly1305_NPUBBYTES = 8;    const aead_chacha20poly1305_ABYTES = 16;     const aead_chacha20poly1305_IETF_KEYBYTES = 32;    const aead_chacha20poly1305_IETF_NSECBYTES = 0;    const aead_chacha20poly1305_IETF_NPUBBYTES = 12;    const aead_chacha20poly1305_IETF_ABYTES = 16;     const aead_xchacha20poly1305_IETF_KEYBYTES = 32;    const aead_xchacha20poly1305_IETF_NSECBYTES = 0;    const aead_xchacha20poly1305_IETF_NPUBBYTES = 24;    const aead_xchacha20poly1305_IETF_ABYTES = 16;     const box_curve25519xsalsa20poly1305_SEEDBYTES = 32;    const box_curve25519xsalsa20poly1305_PUBLICKEYBYTES = 32;    const box_curve25519xsalsa20poly1305_SECRETKEYBYTES = 32;    const box_curve25519xsalsa20poly1305_BEFORENMBYTES = 32;    const box_curve25519xsalsa20poly1305_NONCEBYTES = 24;    const box_curve25519xsalsa20poly1305_MACBYTES = 16;    const box_curve25519xsalsa20poly1305_BOXZEROBYTES = 16;    const box_curve25519xsalsa20poly1305_ZEROBYTES = 32;     const onetimeauth_poly1305_BYTES = 16;    const onetimeauth_poly1305_KEYBYTES = 32;     const secretbox_xsalsa20poly1305_KEYBYTES = 32;    const secretbox_xsalsa20poly1305_NONCEBYTES = 24;    const secretbox_xsalsa20poly1305_MACBYTES = 16;    const secretbox_xsalsa20poly1305_BOXZEROBYTES = 16;    const secretbox_xsalsa20poly1305_ZEROBYTES = 32;     const secretbox_xchacha20poly1305_KEYBYTES = 32;    const secretbox_xchacha20poly1305_NONCEBYTES = 24;    const secretbox_xchacha20poly1305_MACBYTES = 16;    const secretbox_xchacha20poly1305_BOXZEROBYTES = 16;    const secretbox_xchacha20poly1305_ZEROBYTES = 32;     const stream_salsa20_KEYBYTES = 32;     /**     * AEAD Decryption with ChaCha20-Poly1305     *     * @internal Do not use this directly. Use ParagonIE_Sodium_Compat.     *     * @param string $message     * @param string $ad     * @param string $nonce     * @param string $key     * @return string     * @throws SodiumException     * @throws TypeError     */    public static function aead_chacha20poly1305_decrypt(        $message = '',        $ad = '',        $nonce = '',        $key = ''    ) {        /** @var int $len - Length of message (ciphertext + MAC) */        $len = ParagonIE_Sodium_Core32_Util::strlen($message);         /** @var int  $clen - Length of ciphertext */        $clen = $len - self::aead_chacha20poly1305_ABYTES;         /** @var int $adlen - Length of associated data */        $adlen = ParagonIE_Sodium_Core32_Util::strlen($ad);         /** @var string $mac - Message authentication code */        $mac = ParagonIE_Sodium_Core32_Util::substr(            $message,            $clen,            self::aead_chacha20poly1305_ABYTES        );         /** @var string $ciphertext - The encrypted message (sans MAC) */        $ciphertext = ParagonIE_Sodium_Core32_Util::substr($message, 0, $clen);

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/sodium_compat/src/Crypto32.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.