ParagonIE_Sodium_Core_Curve25519_Fe::fromArray

Advertisement

Syntax Syntax

ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( $array, bool $save_indexes = null )

Parameters Parameters

(Required) int> $array

$save_indexes

(Optional)

Default value: null

Return Return

(self)

Source Source

File: wp-includes/sodium_compat/src/Core/Curve25519/Fe.php

    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);
        /** @var array<int, int> $keys */

        $obj = new ParagonIE_Sodium_Core_Curve25519_Fe();
        if ($save_indexes) {
            for ($i = 0; $i < $count; ++$i) {
                $obj->offsetSet($keys[$i], $array[$i]);
            }
        } else {
            for ($i = 0; $i < $count; ++$i) {
                $obj->offsetSet($i, $array[$i]);
            }
        }
        return $obj;
    }

Advertisement

Advertisement

Leave a Reply