ParagonIE_Sodium_Core_XChaCha20::ietfStreamXorIc

Advertisement

Syntax Syntax

ParagonIE_Sodium_Core_XChaCha20::ietfStreamXorIc( string $message, string $nonce = '', string $key = '', string $ic = '' )

Parameters Parameters

$message

(Required)

$nonce

(Optional)

Default value: ''

$key

(Optional)

Default value: ''

$ic

(Optional)

Default value: ''

Return Return

(string)

Source Source

File: wp-includes/sodium_compat/src/Core/XChaCha20.php

    public static function ietfStreamXorIc($message, $nonce = '', $key = '', $ic = '')
    {
        if (self::strlen($nonce) !== 24) {
            throw new SodiumException('Nonce must be 24 bytes long');
        }
        return self::encryptBytes(
            new ParagonIE_Sodium_Core_ChaCha20_IetfCtx(
                self::hChaCha20(self::substr($nonce, 0, 16), $key),
                "\x00\x00\x00\x00" . self::substr($nonce, 16, 8),
                $ic
            ),
            $message
        );
    }

Advertisement

Advertisement

Leave a Reply