WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта
функция не описана

ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor() public WP 1.0

DANGER! UNAUTHENTICATED ENCRYPTION!

Unless you are following expert advice, do not used this feature.

Algorithm: XChaCha20

This DOES NOT provide ciphertext integrity.

{} Это метод класса: ParagonIE_Sodium_Compat{}

Хуков нет.

Возвращает

Строку. Encrypted text which is vulnerable to chosen- ciphertext attacks unless you implement some other mitigation to the ciphertext (i.e. Encrypt then MAC)

Использование

$result = ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor( $message, $nonce, $key, $dontFallback );
$message(строка) (обязательный)
Plaintext message
$nonce(строка) (обязательный)
Number to be used Once; must be 24 bytes
$key(строка) (обязательный)
Encryption key
$dontFallback *(true false)*

Код ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor() WP 5.8

<?php
public static function crypto_stream_xchacha20_xor($message, $nonce, $key, $dontFallback = false)
{
    /* Type checks: */
    ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
    ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2);
    ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 3);

    /* Input validation: */
    if (ParagonIE_Sodium_Core_Util::strlen($nonce) !== self::CRYPTO_STREAM_XCHACHA20_NONCEBYTES) {
        throw new SodiumException('Argument 2 must be CRYPTO_SECRETBOX_XCHACHA20_NONCEBYTES long.');
    }
    if (ParagonIE_Sodium_Core_Util::strlen($key) !== self::CRYPTO_STREAM_XCHACHA20_KEYBYTES) {
        throw new SodiumException('Argument 3 must be CRYPTO_SECRETBOX_XCHACHA20_KEYBYTES long.');
    }

    if (self::useNewSodiumAPI() && !$dontFallback) {
        return sodium_crypto_stream_xchacha20_xor($message, $nonce, $key);
    }
    if (PHP_INT_SIZE === 4) {
        return ParagonIE_Sodium_Core32_XChaCha20::streamXorIc($message, $nonce, $key);
    }
    return ParagonIE_Sodium_Core_XChaCha20::streamXorIc($message, $nonce, $key);
}