ParagonIE_Sodium_Core_BLAKE2b::store64

Advertisement

Syntax Syntax

ParagonIE_Sodium_Core_BLAKE2b::store64( SplFixedArray $x, int $i, SplFixedArray $u )

Parameters Parameters

$x

(Required)

$i

(Required)

$u

(Required)

Return Return

(void)

Source Source

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

    protected static function store64(SplFixedArray $x, $i, SplFixedArray $u)
    {
        $maxLength = $x->getSize() - 1;
        for ($j = 0; $j < 8; ++$j) {
            /*
               [0, 1, 2, 3, 4, 5, 6, 7]
                    ... becomes ...
               [0, 0, 0, 0, 1, 1, 1, 1]
            */
            /** @var int $uIdx */
            $uIdx = ((7 - $j) & 4) >> 2;
            $x[$i]   = ((int) ($u[$uIdx]) & 0xff);
            if (++$i > $maxLength) {
                return;
            }
            /** @psalm-suppress MixedOperand */
            $u[$uIdx] >>= 8;
        }
    }

Advertisement

Advertisement

Leave a Reply