ParagonIE_Sodium_Compat::hex2bin

Advertisement

Summery Summery

Cache-timing-safe implementation of hex2bin().

Syntax Syntax

ParagonIE_Sodium_Compat::hex2bin( string $string )

Parameters Parameters

$string

(Required) Hexadecimal string

Return Return

(string) Raw binary string

Source Source

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

    public static function hex2bin($string)
    {
        /* Type checks: */
        ParagonIE_Sodium_Core_Util::declareScalarType($string, 'string', 1);

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

Advertisement

Advertisement

Leave a Reply