From 75160b12821f7f4299cce7f0b69c83c1502ae071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 27 May 2024 13:08:29 +0200 Subject: 2024-02-19 upstream --- .../sodium_compat/src/Core32/XChaCha20.php | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'vendor/paragonie/sodium_compat/src/Core32/XChaCha20.php') diff --git a/vendor/paragonie/sodium_compat/src/Core32/XChaCha20.php b/vendor/paragonie/sodium_compat/src/Core32/XChaCha20.php index 1dfc859..404e8d2 100644 --- a/vendor/paragonie/sodium_compat/src/Core32/XChaCha20.php +++ b/vendor/paragonie/sodium_compat/src/Core32/XChaCha20.php @@ -61,4 +61,27 @@ class ParagonIE_Sodium_Core32_XChaCha20 extends ParagonIE_Sodium_Core32_HChaCha2 $message ); } + + /** + * @internal You should not use this directly from another application + * + * @param string $message + * @param string $nonce + * @param string $key + * @param string $ic + * @return string + * @throws SodiumException + * @throws TypeError + */ + public static function ietfStreamXorIc($message, $nonce = '', $key = '', $ic = '') + { + return self::encryptBytes( + new ParagonIE_Sodium_Core32_ChaCha20_IetfCtx( + self::hChaCha20(self::substr($nonce, 0, 16), $key), + "\x00\x00\x00\x00" . self::substr($nonce, 16, 8), + $ic + ), + $message + ); + } } -- cgit v1.2.3