ParagonIE_Sodium_Compat::hex2bin() – Cache-timing-safe implementation of hex2bin().

You appear to be a bot. Output may be restricted

Description

Cache-timing-safe implementation of hex2bin().

Usage

$string = ParagonIE_Sodium_Compat::hex2bin( $string, $ignore );

Parameters

$string
( string ) required – Hexadecimal string
$ignore
( string ) optional – List of characters to ignore; useful for whitespace

Returns

string Raw binary string

Source

File name: wordpress/wp-includes/sodium_compat/src/Compat.php


Lines:

1 to 18 of 18
    public static function hex2bin($string, $ignore = '')
    {
        /* Type checks: */
        ParagonIE_Sodium_Core_Util::ParagonIE_Sodium_Core_Util::declareScalarType($string, 'string', 1);
        ParagonIE_Sodium_Core_Util::ParagonIE_Sodium_Core_Util::declareScalarType($ignore, 'string', 2);

        if (self::useNewSodiumAPI()) {
            if (is_callable('sodium_hex2bin')) {
                return (string) sodium_hex2bin($string, $ignore);
            }
        }
        if (self::use_fallback('hex2bin')) {
            return (string) call_user_func('\\Sodium\\hex2bin', $string, $ignore);
        }
        return ParagonIE_Sodium_Core_Util::ParagonIE_Sodium_Core_Util::hex2bin($string, $ignore);
    }
 

 View on GitHub View on Trac