
    df              
          d dl Z 	 d dlZd dlmZmZ d dlmZ	 	 d dlm
Z
 dZddlmZ ddlmZmZmZ i Zere
j&                  ged	<   d
ed<   dZdZdZdZdZ eede      Z eeeee      Z eddd      Z eeddd      Z ee      Zded<    ed$i e e e	j>                  dedz               d               Z d Z!e jD                  jG                  d e$ e!ed            D  cg c]
  \  } }e| |f c}}  e%d      D cg c]  }djM                  |       c}      d        Z' G d  d!ejP                        Z) G d" d#ejP                        Z*y# e$ r d dlZY Sw xY w# e$ r dZY Jw xY wc c}} w c c}w )%    N)givensettings)HealthCheckTF   )inverse_mod)CurveFpINFINITYPointsuppress_health_checki  deadline      1(i&^#a;   9{uDjSg9g(B   +' 1t:_|v!a:@m   H<^W]dZ{cxW\Iq          
   max_examples)	min_value	max_valuec                 R    t        | t              }t        | z  }||z  t        k(  sJ y N)r   rp192)multipleinv_mp1s      Q/home/api-vastappli/venv/lib/python3.12/site-packages/ecdsa/test_ellipticcurve.pytest_p192_mult_testsr"   .   s+     !$E	B:    c              #   P   K   t         }d}||k  r| || z   }|dz  }||k  ry y w)Nr   r   )r	   )pointnretis       r!   add_n_timesr)   7   s7     
C	A
q&	Ek	Q q&s   !&&zp, m, check   	   zg_23 test with mult {0})idsc                     | |z  |k(  sJ y r    )pmchecks      r!   test_add_and_mult_equivalencer2   A   s     q5E>>r#   c                   :    e Zd Zed        Zd Zd Zd Zd Zd Z	y)	TestCurvec                 (    t        ddd      | _        y Nr   r   )r   c_23)clss    r!   
setUpClasszTestCurve.setUpClassK   s    2q!$r#   c                 R    | j                  | j                  t        ddd             y r6   )assertEqualr7   r   selfs    r!   test_equality_curveszTestCurve.test_equality_curvesO   s    GB1$56r#   c                 f    t        t        dt              }| j                  | j                  |       y )Nr   )r   r/   bassertNotEqualr7   )r=   c192s     r!   test_inequality_curvesz TestCurve.test_inequality_curvesR   s$    q"a DIIt,r#   c                      | j                   d i y r   )r7   r<   s    r!   ,test_usability_in_a_hashed_collection_curvesz6TestCurve.test_usability_in_a_hashed_collection_curvesV   s    	Dr#   c                 .    t        | j                         y r   )hashr7   r<   s    r!   test_hashability_curvesz!TestCurve.test_hashability_curvesY   s    TYYr#   c           
         t        ddd      t        ddd      t        ddd      }}}t        ddd      t        ddd      | j                  }}}| j                  t        t	        t        |||f            d       | j                  t        t	        t        |||f            d       | j                  t        d i|d i       | j                  ||d i       y )N   r   r         )r   r7   r;   lensetassertDictEqualassertIn)r=   ne1ne2ne3eq1eq2eq3s          r!   test_conflation_curvesz TestCurve.test_conflation_curves\   s    Aq)72q!+<gb!Q>O#SAq)72q!+<dii#SS$S#!678!<S$S#!678!<dD\C;7cC;'r#   N)
__name__
__module____qualname__classmethodr9   r>   rC   rE   rH   rW   r.   r#   r!   r4   r4   J   s-    % %7-(r#   r4   c                   R    e Zd Zed        Zd Zd Zd Zd Zd Z	d Z
d Zd	 Zd
 Zy)	TestPointc                     t        ddd      | _        t        | j                  ddd      | _        d}d}d}d}d	}t        |d
|      | _        t        | j                  |||      | _        y )Nr   r   r   r   r   r   r   r   r   r   )r   r7   r
   g_23rB   r   )r8   r/   r   r@   GxGys         r!   r9   zTestPoint.setUpClassf   si    2q!$2q!,FF ???1b!$2r1-r#   c                    d}|| j                   z  }| j                  |j                         d       d}|| j                   z  }| j                  |j                         d       | j                  |j                         d       d}d}|| j                   z  ||z  z   }| j                  |j                         d       | j                  |j                         d       y )Nl   uH=.t.#",W}7?jl   Z`uSG;R-]]0sk	+l   N/vZL_~XXw]ol   ~n&DJ,6'1a47b?`l   5XD+8n#w}rO	l   WTY>n+BtC*Yql   !M_JT96wfF[,z=)r   r;   xy)r=   dQkRu1u2temps           r!   	test_p192zTestPoint.test_p192v   s     F		MCCEE	
 G		MCCEE	
 	CCEE	
 HGDII~Q&FFHH	
 	FFHH	
r#   c                    t         }|j                         }| j                  ||       | j                  |j                         |j                                | j                  |j	                         |j	                                y r   )r	   doubler;   rc   rd   )r=   r    p3s      r!   test_double_infinityzTestPoint.test_double_infinity   sZ    YY[R ((r#   c                     d\  }}}}t        | j                  ||      }|j                         }| j                  |j	                         |       | j                  |j                         |       y )N)   r   r      )r
   r7   rn   r;   rc   rd   )r=   x1y1x3y3r    ro   s          r!   test_doublezTestPoint.test_double   sX    'BB499b"%YY[$$r#   c                     d\  }}}}}t        | j                  ||      }||z  }| j                  |j                         |       | j                  |j	                         |       y )N)rr   r   rK   r   rs   r
   r7   r;   rc   rd   )r=   rt   ru   r0   rv   rw   r    ro   s           r!   test_multiplyzTestPoint.test_multiply   sY    -B2r499b"%!V$$r#   c                     d\  }}}}}}t        | j                  ||      }t        | j                  ||      }||z   }	| j                  |	j                         |       | j                  |	j	                         |       y):We expect that on curve c, (x1,y1) + (x2, y2 ) = (x3, y3).)rr   r   r+   r         Nrz   
r=   rt   ru   x2y2rv   rw   r    p2ro   s
             r!   test_addzTestPoint.test_add   o     "7BBB499b"%499b"%"W$$r#   c                     d\  }}}}}}t        | j                  ||      }t        | j                  ||      }||z   }	| j                  |	j                         |       | j                  |	j	                         |       y)r}   )rr   r   rr   r   r   rs   Nrz   r   s
             r!   test_add_as_doublezTestPoint.test_add_as_double   r   r#   c           	      h    | j                  | j                  t        | j                  ddd             y )Nr   r   )r;   r_   r
   r7   r<   s    r!   test_equality_pointszTestPoint.test_equality_points   s%    E$))RA$>?r#   c                 r    t        ddd      }t        |ddd      }| j                  | j                  |       y Nd   r   )r   r
   rA   r_   )r=   cr/   s      r!   test_inequality_pointsz TestPoint.test_inequality_points   s4    CS!!S#s#DIIq)r#   c                 V    t        ddd      }| j                  | j                  |       y r   )r   rA   r_   )r=   r   s     r!   !test_inequality_points_diff_typesz+TestPoint.test_inequality_points_diff_types   s$    CS!DIIq)r#   N)rX   rY   rZ   r[   r9   rl   rp   rx   r{   r   r   r   r   r   r.   r#   r!   r]   r]   e   sB    . .
8)%%%%@*
*r#   r]   r.   )+pytest	unittest2unittestImportError
hypothesisr   r   hypothesis.strategies
strategiesstr   
HC_PRESENTnumbertheoryr   ellipticcurver   r	   r
   HYP_SETTINGStoo_slowr/   r   r@   r`   ra   rB   r   r7   r_   dictHYP_SLOW_SETTINGSintegersr"   r)   markparametrize	enumeraterangeformatr2   TestCaser4   r]   )r&   expr(   s   000r!   <module>r      s     ' "&J & 3 3 -8-A-A,BL()#L ?> 777q"aT2r1r1aT2q! & $& . ! 
{r{{Q!a%01 2  "+Ka,@"AB3dAs^B6;Ah?	"	)	)!	,?  

(!! (6b*!! b*A    Jj C?s.   E E! $E/ E5	EE!E,+E,