public static function ParagonIE_Sodium_Core_Curve25519_Fe::fromArray in Automatic Updates 7
Same name and namespace in other branches
- 8 vendor/paragonie/sodium_compat/src/Core/Curve25519/Fe.php \ParagonIE_Sodium_Core_Curve25519_Fe::fromArray()
@internal You should not use this directly from another application
Parameters
array<int, int> $array:
bool $save_indexes:
Return value
self
14 calls to ParagonIE_Sodium_Core_Curve25519_Fe::fromArray()
- ParagonIE_Sodium_Core_Curve25519::fe_0 in vendor/
paragonie/ sodium_compat/ src/ Core/ Curve25519.php - Get a field element of size 10 with a value of 0
- ParagonIE_Sodium_Core_Curve25519::fe_1 in vendor/
paragonie/ sodium_compat/ src/ Core/ Curve25519.php - Get a field element of size 10 with a value of 1
- ParagonIE_Sodium_Core_Curve25519::fe_add in vendor/
paragonie/ sodium_compat/ src/ Core/ Curve25519.php - Add two field elements.
- ParagonIE_Sodium_Core_Curve25519::fe_cmov in vendor/
paragonie/ sodium_compat/ src/ Core/ Curve25519.php - Constant-time conditional move.
- ParagonIE_Sodium_Core_Curve25519::fe_frombytes in vendor/
paragonie/ sodium_compat/ src/ Core/ Curve25519.php - Give: 32-byte string. Receive: A field element object to use for internal calculations.
File
- vendor/
paragonie/ sodium_compat/ src/ Core/ Curve25519/ Fe.php, line 31
Class
- ParagonIE_Sodium_Core_Curve25519_Fe
- Class ParagonIE_Sodium_Core_Curve25519_Fe
Code
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;
}