- COPYRIGHT AND LICENSE
Math::EllipticCurve::Prime - elliptic curve operations over prime fields
use Math::EllipticCurve::Prime; my $curve = Math::EllipticCurve::Prime->from_name('secp256r1'); my $point = $curve->g; # Base point of the curve. $point->bdbl; # In-place operation. print "(" . $point->x . ", " . $point->y . ")\n";
This class represents an elliptic curve over a prime field. These curves are commonly used in cryptography. Consequently, a set of commonly-used curves (and aliases for those curves) is provided by name. The curve itself is generally not very interesting; Math::EllipticCurve::Prime::Point will see much more use in the typical scenario.
Creates a new curve. This function takes a hash of parameters. The curve can either be specified by name (parameter name) using a common name for the curve, or the components can be specified individually.
The parameters are p, a prime; a and b, the constants which define the curve; g, the base point, which functions as a generator; n, the order of g; and h, the cofactor. The integers can either be specified as hexadecimal strings or Math::BigInt instances, and the base point can be specified either as an instance of Meth::EllipticCurve::Prime::Point or a string suitable for that class's from_hex function.
Takes a single argument, the name of the curve.
Returns the canonical name of this curve if it was created by name.
Returns a Math::BigInt representing p, the prime.
Returns a Math::BigInt representing a, the coefficient of x and one of the numbers which defines the curve.
Returns a Math::BigInt representing b, the constant and one of the numbers which defines the curve.
Returns a Math::EllipticCurve::Prime::Point object representing g, the base point and generator.
Returns a Math::BigInt object representing n, the order of g.
Returns a Math::BigInt object representing h, the cofactor.
This module will function just fine with the default Math::BigInt, but it will be unusably slow. If Math::BigInt::FastCalc is available, it will be just somewhat slow (679 seconds to run the testsuite). For reasonable performance, Math::BigInt::GMP (25 seconds) is strongly recommended.
brian m. carlson <email@example.com>
This software is copyright (c) 2013 by brian m. carlson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.