diff options
Diffstat (limited to 'vendor/paragonie/sodium_compat/src/Core32/XChaCha20.php')
-rw-r--r-- | vendor/paragonie/sodium_compat/src/Core32/XChaCha20.php | 23 |
1 files changed, 23 insertions, 0 deletions
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 + ); + } } |