ParagonIE_Sodium_Core_BLAKE2b::context

Advertisement

Summery Summery

Returns a fresh BLAKE2 context.

Syntax Syntax

ParagonIE_Sodium_Core_BLAKE2b::context()

Return Return

(SplFixedArray)

Source Source

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

    protected static function context()
    {
        $ctx    = new SplFixedArray(6);
        $ctx[0] = new SplFixedArray(8);   // h
        $ctx[1] = new SplFixedArray(2);   // t
        $ctx[2] = new SplFixedArray(2);   // f
        $ctx[3] = new SplFixedArray(256); // buf
        $ctx[4] = 0;                      // buflen
        $ctx[5] = 0;                      // last_node (uint8_t)

        for ($i = 8; $i--;) {
            $ctx[0][$i] = self::$iv[$i];
        }
        for ($i = 256; $i--;) {
            $ctx[3][$i] = 0;
        }

        $zero = self::new64(0, 0);
        $ctx[1][0] = $zero;
        $ctx[1][1] = $zero;
        $ctx[2][0] = $zero;
        $ctx[2][1] = $zero;

        return $ctx;
    }

Advertisement

Advertisement

Leave a Reply