ParagonIE_Sodium_Core_Util::store_3

Advertisement

Summery Summery

Store a 24-bit integer into a string, treating it as big-endian.

Syntax Syntax

ParagonIE_Sodium_Core_Util::store_3( int $int )

Parameters Parameters

$int

(Required)

Return Return

(string)

Source Source

File: wp-includes/sodium_compat/src/Core/Util.php

    public static function store_3($int)
    {
        /* Type checks: */
        if (!is_int($int)) {
            if (is_numeric($int)) {
                $int = (int) $int;
            } else {
                throw new TypeError('Argument 1 must be an integer, ' . gettype($int) . ' given.');
            }
        }
        /** @var string $packed */
        $packed = pack('N', $int);
        return self::substr($packed, 1, 3);
    }

Advertisement

Advertisement

Leave a Reply