%PDF- %PDF-
Direktori : /proc/self/root/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ |
Current File : //proc/self/root/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyc |
� �ac @ s d d l m Z y d d l m Z e Z WnE e k rq y d d l m Z e Z Wn e k rm e Z n Xn Xd d l m Z d d l m Z d d l m Z e d e f d � � Y� Z d e f d � � YZ d e f d � � YZ e e e e � Z d S( i����( t division( t mpz( t python_2_unicode_compatiblei ( t numbertheory( t RWLockt CurveFpc B sw e Z d Z e r! d d � Z n d d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z RS( s9 Elliptic Curve over the field of integers modulo a prime.c C s: t | � | _ t | � | _ t | � | _ | | _ d S( su The curve of points satisfying y^2 = x^3 + a*x + b (mod p). h is an integer that is the cofactor of the elliptic curve domain parameters; it is the number of points satisfying the elliptic curve equation divided by the order of the base point. It is used for selection of efficient algorithm for public point verification. N( R t _CurveFp__pt _CurveFp__at _CurveFp__bt _CurveFp__h( t selft pt at bt h( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyt __init__; s c C s( | | _ | | _ | | _ | | _ d S( su The curve of points satisfying y^2 = x^3 + a*x + b (mod p). h is an integer that is the cofactor of the elliptic curve domain parameters; it is the number of points satisfying the elliptic curve equation divided by the order of the base point. It is used for selection of efficient algorithm for public point verification. N( R R R R ( R R R R R ( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyR K s c C sG t | t � rC | j | j k oB | j | j k oB | j | j k St S( N( t isinstanceR R R R t NotImplemented( R t other( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyt __eq__Y s c C s t | j | j | j f � S( N( t hashR R R ( R ( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyt __hash__a s c C s | j S( N( R ( R ( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyR d s c C s | j S( N( R ( R ( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyR g s c C s | j S( N( R ( R ( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyR j s c C s | j S( N( R ( R ( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyt cofactorm s c C s/ | | | | | j | | j | j d k S( s! Is the point (x,y) on this curve?i ( R R R ( R t xt y( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyt contains_pointp s c C s d | j | j | j | j f S( Ns CurveFp(p=%d, a=%d, b=%d, h=%d)( R R R R ( R ( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyt __str__t s N( t __name__t __module__t __doc__t GMPYt NoneR R R R R R R R R ( ( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyR 6 s t PointJacobic B s e Z d Z d e d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z e e d � � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z e d � � Z d � Z e d � � Z d � Z d � Z RS( s� Point on an elliptic curve. Uses Jacobi coordinates. In Jacobian coordinates, there are three parameters, X, Y and Z. They correspond to affine parameters 'x' and 'y' like so: x = X / Z² y = Y / Z³ c C sK | | _ t � | _ t r` t | � | _ t | � | _ t | � | _ | oW t | � | _ n$ | | _ | | _ | | _ | | _ g | _ | rG| s� t � d } | d 9} t | | | | | � } | d 9} | j j | j � | j � f � xQ | | k rC| d 9} | j � j � } | j j | j � | j � f � q� Wn d S( s Initialise a point that uses Jacobi representation internally. :param CurveFp curve: curve on which the point resides :param int x: the X parameter of Jacobi representation (equal to x when converting from affine coordinates :param int y: the Y parameter of Jacobi representation (equal to y when converting from affine coordinates :param int z: the Z parameter of Jacobi representation (equal to 1 when converting from affine coordinates :param int order: the point order, must be non zero when using generator=True :param bool generator: the point provided is a curve generator, as such, it will be commonly used with scalar multiplication. This will cause to precompute multiplication table for it i i N( t _PointJacobi__curveR t _scale_lockR R t _PointJacobi__xt _PointJacobi__yt _PointJacobi__zt _PointJacobi__ordert _PointJacobi__precomputet AssertionErrorR t appendR R t doublet scale( R t curveR R t zt ordert generatort it doubler( ( sH /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ellipticcurve.pyR � s. " c C sf zL | j j � | t k r. | j p- | j S| j | j | j } } } Wd | j j � Xt | t � r� | j � | j � d } } } nU t | t � r� z. | j j � | j | j | j } } } Wd | j j � Xn t S| j | j � k r� t S| j j � } | | | } | | | } | | | | | d k oe| | | | | | | d k S( s# Compare two points with each-other.Ni i ( R"