PHP Classes

File: src/Core/Curve25519/Ge/P2.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   PHP Sodium Compat   src/Core/Curve25519/Ge/P2.php   Download  
File: src/Core/Curve25519/Ge/P2.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Sodium Compat
Cryptographic functions of libsodium in pure PHP
Author: By
Last change: Stricter typing
Set minimum PHP version to 8.1 for v2.x
Add type checks at runtime
Remove type declarations

There's no way to make them nullable in PHP 5, so it's our only way forward.

I _could_ add runtime type checks, but why bother?
Date: 10 days ago
Size: 1,275 bytes
 

 

Contents

Class file image Download
<?php
declare(strict_types=1);

if (
class_exists('ParagonIE_Sodium_Core_Curve25519_Ge_P2', false)) {
    return;
}

/**
 * Class ParagonIE_Sodium_Core_Curve25519_Ge_P2
 */
class ParagonIE_Sodium_Core_Curve25519_Ge_P2
{
    public
ParagonIE_Sodium_Core_Curve25519_Fe $X;
    public
ParagonIE_Sodium_Core_Curve25519_Fe $Y;
    public
ParagonIE_Sodium_Core_Curve25519_Fe $Z;

   
/**
     * ParagonIE_Sodium_Core_Curve25519_Ge_P2 constructor.
     *
     * @internal You should not use this directly from another application
     *
     * @param ?ParagonIE_Sodium_Core_Curve25519_Fe $x
     * @param ?ParagonIE_Sodium_Core_Curve25519_Fe $y
     * @param ?ParagonIE_Sodium_Core_Curve25519_Fe $z
     */
   
public function __construct(
        ?
ParagonIE_Sodium_Core_Curve25519_Fe $x = null,
        ?
ParagonIE_Sodium_Core_Curve25519_Fe $y = null,
        ?
ParagonIE_Sodium_Core_Curve25519_Fe $z = null
   
) {
        if (
$x === null) {
           
$x = new ParagonIE_Sodium_Core_Curve25519_Fe();
        }
       
$this->X = $x;
        if (
$y === null) {
           
$y = new ParagonIE_Sodium_Core_Curve25519_Fe();
        }
       
$this->Y = $y;
        if (
$z === null) {
           
$z = new ParagonIE_Sodium_Core_Curve25519_Fe();
        }
       
$this->Z = $z;
    }
}