PATH:
home
/
lab2454c
/
costbloc.com
/
vendor
/
phpseclib
/
phpseclib
/
phpseclib
/
Crypt
/
EC
/
Curves
<?php /** * Curve448 * * PHP version 5 and 7 * * @author Jim Wigginton <terrafrost@php.net> * @copyright 2019 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib3\Crypt\EC\Curves; use phpseclib3\Crypt\EC\BaseCurves\Montgomery; use phpseclib3\Math\BigInteger; class Curve448 extends Montgomery { public function __construct() { // 2^448 - 2^224 - 1 $this->setModulo(new BigInteger( 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE' . 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 16 )); $this->a24 = $this->factory->newInteger(new BigInteger('39081')); $this->p = [$this->factory->newInteger(new BigInteger(5))]; // 2^446 - 0x8335dc163bb124b65129c96fde933d8d723a70aadc873d6d54a7bb0d $this->setOrder(new BigInteger( '3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . '7CCA23E9C44EDB49AED63690216CC2728DC58F552378C292AB5844F3', 16 )); /* $this->setCoefficients( new BigInteger('156326'), // a ); $this->setBasePoint( new BigInteger(5), new BigInteger( '355293926785568175264127502063783334808976399387714271831880898' . '435169088786967410002932673765864550910142774147268105838985595290' . '606362') ); */ } /** * Multiply a point on the curve by a scalar * * Modifies the scalar as described at https://tools.ietf.org/html/rfc7748#page-8 * * @return array */ public function multiplyPoint(array $p, BigInteger $d) { //$r = strrev(sodium_crypto_scalarmult($d->toBytes(), strrev($p[0]->toBytes()))); //return [$this->factory->newInteger(new BigInteger($r, 256))]; $d = $d->toBytes(); $d[0] = $d[0] & "\xFC"; $d = strrev($d); $d |= "\x80"; $d = new BigInteger($d, 256); return parent::multiplyPoint($p, $d); } /** * Creates a random scalar multiplier * * @return BigInteger */ public function createRandomMultiplier() { return BigInteger::random(446); } /** * Performs range check */ public function rangeCheck(BigInteger $x) { if ($x->getLength() > 448 || $x->isNegative()) { throw new \RangeException('x must be a positive integer less than 446 bytes in length'); } } }
[-] nistp521.php
[edit]
[-] sect283r1.php
[edit]
[-] sect409k1.php
[edit]
[-] secp192r1.php
[edit]
[-] secp112r2.php
[edit]
[-] secp224k1.php
[edit]
[-] brainpoolP512t1.php
[edit]
[-] brainpoolP160t1.php
[edit]
[-] secp160r1.php
[edit]
[-] secp192k1.php
[edit]
[-] nistb409.php
[edit]
[-] prime192v1.php
[edit]
[-] brainpoolP384r1.php
[edit]
[-] brainpoolP512r1.php
[edit]
[-] nistp192.php
[edit]
[+]
..
[-] Curve25519.php
[edit]
[-] prime239v3.php
[edit]
[-] sect233k1.php
[edit]
[-] secp256r1.php
[edit]
[-] nistp384.php
[edit]
[-] sect163r2.php
[edit]
[-] sect131r2.php
[edit]
[-] sect131r1.php
[edit]
[-] prime256v1.php
[edit]
[-] secp224r1.php
[edit]
[-] secp128r1.php
[edit]
[-] sect409r1.php
[edit]
[-] brainpoolP256r1.php
[edit]
[-] brainpoolP320t1.php
[edit]
[-] brainpoolP224r1.php
[edit]
[-] sect113r1.php
[edit]
[-] sect113r2.php
[edit]
[-] brainpoolP384t1.php
[edit]
[-] prime239v2.php
[edit]
[-] nistk163.php
[edit]
[-] nistp256.php
[edit]
[-] Curve448.php
[edit]
[-] prime192v2.php
[edit]
[-] nistb233.php
[edit]
[-] nistp224.php
[edit]
[-] sect163k1.php
[edit]
[-] secp112r1.php
[edit]
[-] sect193r1.php
[edit]
[-] brainpoolP192r1.php
[edit]
[-] prime239v1.php
[edit]
[-] sect193r2.php
[edit]
[-] nistk409.php
[edit]
[-] secp256k1.php
[edit]
[-] secp160r2.php
[edit]
[-] sect163r1.php
[edit]
[-] brainpoolP192t1.php
[edit]
[-] nistk283.php
[edit]
[-] secp160k1.php
[edit]
[-] brainpoolP256t1.php
[edit]
[-] Ed25519.php
[edit]
[-] prime192v3.php
[edit]
[-] sect571r1.php
[edit]
[-] secp128r2.php
[edit]
[-] sect283k1.php
[edit]
[-] sect233r1.php
[edit]
[-] sect239k1.php
[edit]
[-] sect571k1.php
[edit]
[-] secp521r1.php
[edit]
[-] Ed448.php
[edit]
[-] brainpoolP224t1.php
[edit]
[-] secp384r1.php
[edit]
[-] nistt571.php
[edit]
[-] brainpoolP320r1.php
[edit]
[-] brainpoolP160r1.php
[edit]
[-] nistk233.php
[edit]