sodium_crypto_secretstream_xchacha20poly1305_push

FunctionParams and return types changed in PHP 8.0

Encrypt a chunk of data so that it can safely be decrypted in a streaming API.

PHP 5
PHP 7.0-7.1
PHP 7.2
Added
PHP 7.3-7.4
PHP 8.0
Improved
PHP 8.1
PHP 8.2
PHP 8.3
PHP 8.4
PHP 8.5

sodium_crypto_secretstream_xchacha20poly1305_push Function synopsis

sodium_crypto_secretstream_xchacha20poly1305_push(
    string &$state,
    string $message,
    string $additional_data = "",
    int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE
  ): string

Parameters

$state

Passed by referenceTypestring

See sodium_crypto_secretstream_xchacha20poly1305_init_pull and sodium_crypto_secretstream_xchacha20poly1305_init_push

$message

Typestring

$additional_data

OptionalTypestringDefault value""

$tag

OptionalTypeintDefault valueSODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE

Optional. Can be used to assert decryption behavior (i.e. re-keying or indicating the final chunk in a stream).

Note that the parameter $state is passed by reference, and contains additional/updated context data that may be useful.

Return value

Typestring

Returns the encrypted ciphertext.

Changes to the sodium_crypto_secretstream_xchacha20poly1305_push Function

PHP 8.0

  • Return type added: string
  • Parameter type added for parameter #1 ($state): string
  • Parameter name of parameter #2 changed: $string to $message
  • Parameter type added for parameter #2 ($message): string
  • Parameter name of parameter #3 changed: $string to $additional_data
  • Parameter type added for parameter #3 ($additional_data): string
  • Parameter default value added for position #3 ($additional_data): ""
  • Parameter name of parameter #4 changed: $long to $tag
  • Parameter type added for parameter #4 ($tag): int
  • Parameter default value added for position #4 ($tag): SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE
  sodium_crypto_secretstream_xchacha20poly1305_push(
-     &$state,
+     string &$state,
-     $string,
+     string $message,
-     $string,
+     string $additional_data = "",
-     $long
+     int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE
-   )
+   ): string

PHP 7.2

  • Function added

sodium_crypto_secretstream_xchacha20poly1305_push Function Availability

PHP VersionAvailability
PHP 8.5Future Release Yes
PHP 8.4Upcoming Release Yes
PHP 8.3Supported (Latest) Yes
PHP 8.2Supported Yes
PHP 8.1Security-Fixes Only Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported No
PHP 7.0Unsupported No
PHP 5.6Unsupported No
PHP 5.5Unsupported No
PHP 5.4Unsupported No
PHP 5.3Unsupported No