You are here

public static function ParagonIE_Sodium_Compat::memcmp in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::memcmp()

Compare two strings.

@psalm-suppress MixedArgument

Parameters

string $left:

string $right:

Return value

int

Throws

SodiumException

TypeError

2 calls to ParagonIE_Sodium_Compat::memcmp()
php72compat.php in vendor/paragonie/sodium_compat/lib/php72compat.php
sodium_compat.php in vendor/paragonie/sodium_compat/lib/sodium_compat.php

File

vendor/paragonie/sodium_compat/src/Compat.php, line 3163

Class

ParagonIE_Sodium_Compat

Code

public static function memcmp($left, $right) {

  /* Type checks: */
  ParagonIE_Sodium_Core_Util::declareScalarType($left, 'string', 1);
  ParagonIE_Sodium_Core_Util::declareScalarType($right, 'string', 2);
  if (self::useNewSodiumAPI()) {
    return sodium_memcmp($left, $right);
  }
  if (self::use_fallback('memcmp')) {
    return (int) call_user_func('\\Sodium\\memcmp', $left, $right);
  }

  /** @var string $left */

  /** @var string $right */
  return ParagonIE_Sodium_Core_Util::memcmp($left, $right);
}