• 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

72.22
/src/Math/SW_QT_ANeg3_Math.php
1
<?php
2

3
namespace Famoser\Elliptic\Math;
4

5
use Famoser\Elliptic\Math\Twister\QuadraticTwister;
6
use Famoser\Elliptic\Primitives\Curve;
7
use Famoser\Elliptic\Primitives\Point;
8
use Famoser\Elliptic\Primitives\QuadraticTwist;
9

10
/**
11
 * Assumes Short Weierstrass curve which can be transformed by a quadratic twist to a Short Weierstrass curve with a=-3.
12
 *
13
 * Some hardening against side-channels has been done.
14
 */
15
class SW_QT_ANeg3_Math extends AbstractMath implements MathInterface
16
{
17
    private readonly QuadraticTwister $twister;
18
    private readonly SW_ANeg3_Math $math;
19

UNCOV
20
    public function __construct(Curve $curve, QuadraticTwist $twist)
×
21
    {
22
        parent::__construct($curve);
×
23

24
        $this->twister = new QuadraticTwister($curve, $twist);
×
UNCOV
25
        $twistedCurve = $this->twister->twistCurve();
×
26

27
        $this->math = new SW_ANeg3_Math($twistedCurve);
×
28
    }
29

30
    public function add(Point $a, Point $b): Point
21✔
31
    {
32
        $twistedA = $this->twister->twistPoint($a);
21✔
33
        $twistedB = $this->twister->twistPoint($b);
21✔
34

35
        $twistedResult = $this->math->add($twistedA, $twistedB);
21✔
36

37
        return $this->twister->untwistPoint($twistedResult);
21✔
38
    }
39

40
    public function double(Point $a): Point
21✔
41
    {
42
        $twistedA = $this->twister->twistPoint($a);
21✔
43

44
        $twistedResult = $this->math->double($twistedA);
21✔
45

46
        return $this->twister->untwistPoint($twistedResult);
21✔
47
    }
48

49
    public function mul(Point $point, \GMP $factor): Point
28✔
50
    {
51
        $twisted = $this->twister->twistPoint($point);
28✔
52

53
        $twistedResult = $this->math->mul($twisted, $factor);
28✔
54

55
        return $this->twister->untwistPoint($twistedResult);
28✔
56
    }
57
}
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