You are here

public static function ParagonIE_Sodium_Core32_XChaCha20::streamXorIc in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/paragonie/sodium_compat/src/Core32/XChaCha20.php \ParagonIE_Sodium_Core32_XChaCha20::streamXorIc()

@internal You should not use this directly from another application

Parameters

string $message:

string $nonce:

string $key:

string $ic:

Return value

string

Throws

SodiumException

TypeError

Overrides ParagonIE_Sodium_Core32_ChaCha20::streamXorIc

File

vendor/paragonie/sodium_compat/src/Core32/XChaCha20.php, line 50

Class

ParagonIE_Sodium_Core32_XChaCha20
Class ParagonIE_Sodium_Core32_XChaCha20

Code

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