ParagonIE_Sodium_Core32_Curve25519_Fe::fromArray() –

You appear to be a bot. Output may be restricted

Description

Usage

$self = ParagonIE_Sodium_Core32_Curve25519_Fe::fromArray( $array, $save_indexes );

Parameters

$array
( mixed ) required
$save_indexes
( bool ) optional

Returns

self

Source

File name: wordpress/wp-includes/sodium_compat/src/Core32/Curve25519/Fe.php


Lines:

1 to 28 of 28
    public static function fromArray($array, $save_indexes = null)
    {
        $count = count($array);
        if ($save_indexes) {
            $keys = array_keys($array);
        } else {
            $keys = range(0, $count - 1);
        }
        $array = array_values($array);

        $obj = new ParagonIE_Sodium_Core32_Curve25519_Fe();
        if ($save_indexes) {
            for ($i = 0; $i < $count; ++$i) {
                $array[$i]->overflow = 0;
                $obj->ParagonIE_Sodium_Core32_Curve25519_Fe::offsetSet($keys[$i], $array[$i]);
            }
        } else {
            for ($i = 0; $i < $count; ++$i) {
                if (!($array[$i] instanceof ParagonIE_Sodium_Core32_Int32)) {
                    throw new TypeError('Expected ParagonIE_Sodium_Core32_Int32');
                }
                $array[$i]->overflow = 0;
                $obj->ParagonIE_Sodium_Core32_Curve25519_Fe::offsetSet($i, $array[$i]);
            }
        }
        return $obj;
    }
 

 View on GitHub View on Trac