• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

famoser / elliptic / 16238255757

12 Jul 2025 01:00PM UTC coverage: 84.857% (-6.3%) from 91.134%
16238255757

Pull #12

github

web-flow
Merge 97611838a into 5ce1049c0
Pull Request #12: WIP: Add montgomery

270 of 376 new or added lines in 17 files covered. (71.81%)

2 existing lines in 1 file now uncovered.

947 of 1116 relevant lines covered (84.86%)

23.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.25
/src/Math/TE_ANeg1_Math.php
1
<?php
2

3
namespace Famoser\Elliptic\Math;
4

5
use Famoser\Elliptic\Math\Calculator\SW_ANeg3_Calculator;
6
use Famoser\Elliptic\Math\Calculator\TE_ANeg1_Calculator;
7
use Famoser\Elliptic\Primitives\Curve;
8
use Famoser\Elliptic\Primitives\Point;
9

10
/**
11
 * Twisted Edwards math for a=-1 mod p
12
 */
13
class TE_ANeg1_Math extends AbstractMath implements MathInterface
14
{
15
    private readonly TE_ANeg1_Calculator $calculator;
16

NEW
17
    public function __construct(Curve $curve)
×
18
    {
NEW
19
        parent::__construct($curve);
×
20

NEW
21
        $this->calculator = new TE_ANeg1_Calculator($curve);
×
22
    }
23

24
    public function add(Point $a, Point $b): Point
3✔
25
    {
26
        $nativeA = $this->calculator->affineToNative($a);
3✔
27
        $nativeB = $this->calculator->affineToNative($b);
3✔
28

29
        $nativeResult = $this->calculator->add($nativeA, $nativeB);
3✔
30

31
        return $this->calculator->nativeToAffine($nativeResult);
3✔
32
    }
33

34
    public function double(Point $a): Point
3✔
35
    {
36
        $nativeA = $this->calculator->affineToNative($a);
3✔
37

38
        $nativeResult = $this->calculator->double($nativeA);
3✔
39

40
        return $this->calculator->nativeToAffine($nativeResult);
3✔
41
    }
42

43
    public function mul(Point $point, \GMP $factor): Point
4✔
44
    {
45
        $native = $this->calculator->affineToNative($point);
4✔
46

47
        $nativeResult = $this->calculator->mul($native, $factor);
4✔
48

49
        return $this->calculator->nativeToAffine($nativeResult);
4✔
50
    }
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc