ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_init_pull

Advertisement

Syntax Syntax

ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_init_pull( string $key, string $header )

Parameters Parameters

$key

(Required)

$header

(Required)

Return Return

(string) Returns a state.

Source Source

File: wp-includes/sodium_compat/src/Crypto32.php

    public static function secretstream_xchacha20poly1305_init_pull($key, $header)
    {
        # crypto_core_hchacha20(state->k, in, k, NULL);
        $subkey = ParagonIE_Sodium_Core32_HChaCha20::hChaCha20(
            ParagonIE_Sodium_Core32_Util::substr($header, 0, 16),
            $key
        );
        $state = new ParagonIE_Sodium_Core32_SecretStream_State(
            $subkey,
            ParagonIE_Sodium_Core32_Util::substr($header, 16)
        );
        $state->counterReset();
        # memcpy(STATE_INONCE(state), in + crypto_core_hchacha20_INPUTBYTES,
        #     crypto_secretstream_xchacha20poly1305_INONCEBYTES);
        # memset(state->_pad, 0, sizeof state->_pad);
        # return 0;
        return $state->toString();
    }

Advertisement

Advertisement

Leave a Reply