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

(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

This site uses Akismet to reduce spam. Learn how your comment data is processed.