Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / asn1crypto / _elliptic_curve.pyc
Size: Mime:
ó
ՍEYc@`s7dZddlmZmZmZmZddlmZdd$d„ƒYZdd%d„ƒYZ	e	d#d#d#ƒZed	d
dƒZe	edd
dƒZ
edd
dƒZe	edddƒZedd
dƒZe	edddƒZedd
dƒZe	edddƒZedd
dƒZe	ed d!d"ƒZd#S(&uÚ
Classes and objects to represent prime-field elliptic curves and points on them.
Exports the following items:

 - PrimeCurve()
 - PrimePoint()
 - SECP192R1_CURVE
 - SECP192R1_BASE_POINT
 - SECP224R1_CURVE
 - SECP224R1_BASE_POINT
 - SECP256R1_CURVE
 - SECP256R1_BASE_POINT
 - SECP384R1_CURVE
 - SECP384R1_BASE_POINT
 - SECP521R1_CURVE
 - SECP521R1_BASE_POINT

The curve constants are all PrimeCurve() objects and the base point constants
are all PrimePoint() objects.

Some of the following source code is derived from
http://webpages.charter.net/curryfans/peter/downloads.html, but has been heavily
modified to fit into this projects lint settings. The original project license
is listed below:

Copyright (c) 2014 Peter Pearson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
i(tunicode_literalstdivisiontabsolute_importtprint_functioni(tinverse_modt
PrimeCurvecB`s eZdZd„Zd„ZRS(uc
    Elliptic curve over a prime field. Characteristic two field curves are not
    supported.
    cC`s||_||_||_dS(u
        The curve of points satisfying y^2 = x^3 + a*x + b (mod p)

        :param p:
            The prime number as an integer

        :param a:
            The component a as an integer

        :param b:
            The component b as an integer
        N(tptatb(tselfRRR((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyt__init__<s		cC`sQ|j|j}|j|j|j}|||j|j|j|jdkS(u~
        :param point:
            A Point object

        :return:
            Boolean if the point is on this curve
        i(tytxRRR(R	tpointty2tx3((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pytcontainsNs	(t__name__t
__module__t__doc__R
R(((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyR6s	t
PrimePointcB`sGeZdZdd„Zd„Zd„Zd„Zd„Zd„Z	RS(u1
    A point on a prime-field elliptic curve
    cC`sƒ||_||_||_||_|jrQ|jj|ƒsQtdƒ‚qQn|jr||jtkrtdƒ‚qndS(u)
        :param curve:
            A PrimeCurve object

        :param x:
            The x coordinate of the point as an integer

        :param y:
            The y coordinate of the point as an integer

        :param order:
            The order of the point, as an integer - optional
        uInvalid EC pointN(tcurveRRtorderRt
ValueErrortINFINITY(R	RRRR((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyR
as						cC`sB|j|jkr:|j|jkr:|j|jkr:dSdSdS(uy
        :param other:
            A PrimePoint object

        :return:
            0 if identical, 1 otherwise
        iiN(RRR(R	tother((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyt__cmp__~s6cC`sý|tkr|S|tkr |S|j|jks8t‚|j|jkr{|j|j|jjdkrntS|jƒSn|jj}|j|jt|j|j|ƒ|}|||j|j|}||j||j|}t|j||ƒS(uq
        :param other:
            A PrimePoint object

        :return:
            A PrimePoint object
        i(	RRtAssertionErrorRRRtdoubleRR(R	RRtlRty3((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyt__add__‹s 
+cC`s#d„}|}|jr(||j}n|dkr8tS|tkrHtS|dksZt‚d|}t|j|j|j|jƒ}||ƒd}|}x€|dkr|jƒ}||@dkrä||@dkrä||}n||@dkr||@dkr||}n|d}qŸW|S(u
        :param other:
            An integer to multiple the Point by

        :return:
            A PrimePoint object
        cS`s=|dkst‚d}x||kr4d|}qW|dS(Niii(R(Rtresult((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pytleftmost_bit³s
iiii(RRRRRRRR(R	RR!tete3t
negative_selftiR ((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyt__mul__ªs*			
" 
 
cC`s||S(u
        :param other:
            An integer to multiple the Point by

        :return:
            A PrimePoint object
        ((R	R((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyt__rmul__Õs	cC`s|jj}|jj}d|j|j|td|j|ƒ|}||d|j|}||j||j|}t|j||ƒS(uS
        :return:
            A PrimePoint object that is twice this point
        ii(RRRRRRR(R	RRRRR((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyRàs0N(
RRRtNoneR
RRR&R'R(((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyR\s	
		+	l
ÿÿÿÿïÿÿÿÿÿÿÿÿiýÿÿÿl
±9³{ÆuŸ†DÜjôSg9–g(Bl
þö+ø'1tÐ:_|v!aÀ:@mˆl
Hò<„^ËW]™dZ{cx´ÿW\Iql
1(¤iÆ&^#aß;æÿÿÿÿÿÿlÀÿÿÿÿÿÿÿÿ?l´«FeY8¢ûwõ-X"PVdÕ/%ÀPP!-l!¸"X”!#BXÕtàJ9!'È|û%»V—AÃ-l4~
f¬&Dvè@hº!Íf¿E0m9_qlM/l=*¸8%éá¸(‹ÿÿÿÿÿÿÿ?lÿÿÿÿÿÿ?@ÿÿlK`¤Oøpq^cv
3,ƒe<
1ÚUê]>{|RŽ*ìÆZl–B11e	%:f=K`¾wrHŽ7g‹HK8ùhklõQ~o ²]ìl+fÚUg+<ð)Z?î8óO†?q!ãOlQ%Æx+ÎOhóbi+}s¼ÿÿÿÿ@ÿÿlÿÿÀÿÿ~ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿlï*Ø'·#.TÒÚEbc+ÆZ'@=D 1 "( ?7N2Zà_+à“|¹ñS/1fl·
ìdáx¢RÃ¥joyU8T(	:Ÿssé"±nèZ‚L÷8kñ&Á"_ÊUl_Ô!òuR×Ð/‡sX0
@qa×NˆQNB&JÞôxS8KJüEéYë
‹	K%Þlls)Š«e`g®w’l
X_[nÐlv|ÿÿÿÿÿÿÿÿÿÿÿÿÿl#ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿl#? VQ(zO†%bï95~cîte1oR{¨VÂÄ;ŒLHw>ÅlÌ-rZE]´"Sr‡&Ga9}*Fl#f=ËÇxóK¿)H-apY$3^Q‹	ná%kù{;/K!u{4-{Š?$íO‚d8ÑV1¶lÇ3s:·l#Pf¢?ÚQôE$XN¨!85aZþÈUȽWL9îYLù¹hûz
Ñf«$Du13otc!û%‘pMxjRr`l#	dp"z\}[ëzˆ3"näZ;PKÜ#
`ü7ÍrËoÁC†QôÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿN(((Rt
__future__RRRRt_intRRRR(RtSECP192R1_CURVEtSECP192R1_BASE_POINTtSECP224R1_CURVEtSECP224R1_BASE_POINTtSECP256R1_CURVEtSECP256R1_BASE_POINTtSECP384R1_CURVEtSECP384R1_BASE_POINTtSECP521R1_CURVEtSECP521R1_BASE_POINT(((sO/home/tvault/.virtenv/lib/python2.7/site-packages/asn1crypto/_elliptic_curve.pyt<module>/sd"&˜