You are here

public static function ParagonIE_Sodium_Core_Util::xorStrings in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Core/Util.php \ParagonIE_Sodium_Core_Util::xorStrings()

Calculate $a ^ $b for two strings.

@internal You should not use this directly from another application

Parameters

string $a:

string $b:

Return value

string

Throws

TypeError

11 calls to ParagonIE_Sodium_Core_Util::xorStrings()
ParagonIE_Sodium_Core32_Salsa20::salsa20_xor in vendor/paragonie/sodium_compat/src/Core32/Salsa20.php
@internal You should not use this directly from another application
ParagonIE_Sodium_Core32_Salsa20::salsa20_xor_ic in vendor/paragonie/sodium_compat/src/Core32/Salsa20.php
@internal You should not use this directly from another application
ParagonIE_Sodium_Core32_XSalsa20::xsalsa20_xor in vendor/paragonie/sodium_compat/src/Core32/XSalsa20.php
Encrypt a string with XSalsa20. Doesn't provide integrity.
ParagonIE_Sodium_Core_Salsa20::salsa20_xor in vendor/paragonie/sodium_compat/src/Core/Salsa20.php
@internal You should not use this directly from another application
ParagonIE_Sodium_Core_Salsa20::salsa20_xor_ic in vendor/paragonie/sodium_compat/src/Core/Salsa20.php
@internal You should not use this directly from another application

... See full list

File

vendor/paragonie/sodium_compat/src/Core/Util.php, line 888

Class

ParagonIE_Sodium_Core_Util
Class ParagonIE_Sodium_Core_Util

Code

public static function xorStrings($a, $b) {

  /* Type checks: */
  if (!is_string($a)) {
    throw new TypeError('Argument 1 must be a string');
  }
  if (!is_string($b)) {
    throw new TypeError('Argument 2 must be a string');
  }
  return (string) ($a ^ $b);
}