You are here

public static function ParagonIE_Sodium_Compat::bin2hex in Automatic Updates 7

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

Cache-timing-safe implementation of bin2hex().

@psalm-suppress MixedArgument

Parameters

string $string A string (probably raw binary):

Return value

string A hexadecimal-encoded string

Throws

SodiumException

TypeError

2 calls to ParagonIE_Sodium_Compat::bin2hex()
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 252

Class

ParagonIE_Sodium_Compat

Code

public static function bin2hex($string) {

  /* Type checks: */
  ParagonIE_Sodium_Core_Util::declareScalarType($string, 'string', 1);
  if (self::useNewSodiumAPI()) {
    return (string) sodium_bin2hex($string);
  }
  if (self::use_fallback('bin2hex')) {
    return (string) call_user_func('\\Sodium\\bin2hex', $string);
  }
  return ParagonIE_Sodium_Core_Util::bin2hex($string);
}