+
    @i3              	          ^ RI t ^ RIHt ^ RIt ^ RIt^ RIHt	 ^ RI
t
^ RIHtHtHt  ^ RIHt Rt^RIHtHtHtHtHtHtHtHtHtHtHt  ^ RIHt R%t ]
PB                  PE                  R
]#! ] RR& ] R,          4       U Uu. uF  w  rY3NK
  	  upp 4      R 4       t$]
PB                  PE                  R. R'O4      R 4       t%]
PB                  PL                  ]
PB                  PE                  R]4      R 4       4       t'R t(R t)R t*R t+ ! R R]PX                  4      t-]	P\                  R 4       t/]	P\                  R 4       t0]	P\                  R 4       t1]	P\                  R 4       t2]	P\                  R 4       t3/ t4]'       d!   ]Pj                  ]Pl                  .]4R&   R]4R&   R]Pn                  9   d   ^]4R &   ]8! ]44      t9R]Pn                  9   d   ^]9R &   M^]9R &    ! R! R"]PX                  4      t: ! R# R$]PX                  4      t;R#   ] d	    ^ RIt EL i ; i  ] d    Rt ELi ; i  ] d     ^ RIHt  EL  ] d	    R	 t  ELi ; ii ; iu upp i )(    N)reduce)givensettingsexample)HealthCheckTF)SquareRootErrorJacobiErrorfactorizationgcdlcmjacobiinverse_modis_prime
next_primesmallprimessquare_root_mod_prime)mpzc                     V # N xs   &U/var/www/html/photoedit/myenv/lib/python3.14/site-packages/ecdsa/test_numbertheory.pyr   r   (   s    H    zprime, next_p:   NNc                 *    \        V 4      V8X  g   Q hR # r   r   )primenext_ps   &&r   test_next_primer    D   s     e&&&r   valc                 *    \        V 4      ^8X  g   Q hR# )   Nr   )r!   s   &r    test_next_prime_with_nums_less_2r$   K   s    c?ar   r   c                    \        4       p\        ^ ^V ^,          ,           4       FD  pW",          V ,          pVP                  V4       \        W04      pWD,          V ,          V8X  d   KD  Q h	  \        ^ V 4       FA  pWQ9   d   K  \        P
                  ! \        4      ;_uu_ 4        \        WP4       RRR4       KC  	  R#   + '       g   i     KX  ; ir   N)setrangeaddr   pytestraisesr   )r   squaresnumsqroot	nonsquares   &     r   +test_square_root_mod_prime_for_small_primesr1   P   s     eGQEQJ'YB$R/{U"b((( ( 1e_	]]?++!)3 ,+ % ,++s   &C  Cc                  0    \        ^^4      p V ^8X  g   Q hR# r   Nr   )as    r    test_square_root_mod_prime_for_2r6   b   s    a#A6M6r   c                  J    \        ^	^e4      p W ,          ^e,          ^	8X  g   Q hR# )b   Nr4   )r/   s    r   *test_square_root_mod_prime_for_small_primer9   g   s#     c2D;!!!r   c                  n    ^p V ^,          ^8X  g   Q h\        ^V 4      pW,          V ,          ^8X  g   Q hR# )   Nr4   pr/   s     r   ,test_square_root_mod_prime_for_p_congruent_5r>   l   7    
Aq5A:: A&D;?ar   c                  n    ^p V ^,          ^8X  g   Q h\        ^V 4      pW,          V ,          ^8X  g   Q hR# )   Nr4   r<   s     r   4test_square_root_mod_prime_for_p_congruent_5_large_drB   t   r?   r   c                   8   a  ] tR t^|t o R tR tR tR tRtV t	R# )TestSquareRootModPrimec                    V P                  \        4      ;_uu_ 4        \        ^^ 4       RRR4       R#   + '       g   i     R# ; i)   N)assertRaisesr	   r   selfs   &r   test_power_of_2_p(TestSquareRootModPrime.test_power_of_2_p}   s,    {++!"b) ,+++s	   5A	c                    V P                  \        4      ;_uu_ 4       p\        ^^4       RRR4       V P                  R\	        XP
                  4      4       R#   + '       g   i     L7; i)rF   Nzno square rootrG   r   r   assertInstr	exceptionrI   es   & r   test_no_square%TestSquareRootModPrime.test_no_square   G    //1!"b) 0 	&AKK(89 0/   AA*	c                    V P                  \        4      ;_uu_ 4       p\        ^^!4       RRR4       V P                  R\	        XP
                  4      4       R#   + '       g   i     L7; i)rF   Np is not primerM   rQ   s   & r   test_non_prime%TestSquareRootModPrime.test_non_prime   rU   rV   c                    V P                  \        4      ;_uu_ 4       p\        RR 4       RRR4       V P                  R\	        XP
                  4      4       R#   + '       g   i     L7; i)i  NrX   i  rM   rQ   s   & r   test_non_prime_with_negative3TestSquareRootModPrime.test_non_prime_with_negative   sG    //1!'3/ 0 	&AKK(89 0/rV   r   N)
__name__
__module____qualname____firstlineno__rJ   rS   rY   r\   __static_attributes____classdictcell____classdict__s   @r   rD   rD   |   s     *::: :r   rD   c                    a V ! \         P                  ! ^^R,          R7      4      oV ! \         P                  ! ^S^,
          R7      P                  V3R l4      4      pVS3# )r#      	min_value	max_valuec                 "   < \        V S4      ^8H  # )r   r   )r   mods   &r   <lambda>'st_two_nums_rel_prime.<locals>.<lambda>   s    c!SkQ&r   )stintegersfilter)drawr-   rm   s   & @r   st_two_nums_rel_primert      sS     r{{Q!T':
;C

a373::&	
C
 8Or   c                     R V9  d   ^VR &   V ! \         P                  ! \        4      \         P                  ! V/ VB P	                  \
        4      ,          4      pV# )ri   )rp   sampled_fromr   rq   rr   r   )rs   argskwargsr   s   &*, r   	st_primesry      sR    & {
$
++t
&v
&
-
-h
7	8E Lr   c                     V ! \        ^R,          R7      4      pV ! \        P                  ! ^ ^V^,          ,           R7      4      pW",          V,          pW13# )r#   rg   rj   rh   )ry   rp   rq   )rs   r   r-   r.   s   &   r   st_num_square_primer|      sF    QW-.E
r{{Q!eqj.A
BC	U	B9r   c                  a V ! \         P                  ! \        ^R,          R7      ^^
R7      4      oV ! \         P                  ! \         P                  ! S4      ^^R7      4      p\	        \
        P                  V^4      pV ! \         P                  ! ^^R7      P                  V3R l4      4      pV Uu. uF%  p\	        \
        P                  V^4      V,          NK'  	  up# u upi )zE
Strategy that returns lists of numbers, all having a common factor.
   r{   min_sizemax_sizerh   c                    < \         P                  ! \         P                  ! \         P                  ! S4      ^R7      ^V R7      #    )r   r   rp   listsrv   )nprimess   &r   rn   &st_comp_with_com_fac.<locals>.<lambda>   s+    bhh02>r   )	rp   r   ry   rv   r   operatormulrq   flatmap)rs   com_fac_primescom_faccomp_primesnumsr   s   &    @r   st_comp_with_com_facr      s    
 
QV,q2FF 
(1rBN X\\>15G
 
a2.66	
K ALLF8<<q)G33LLLs   5+C#c           	       a	 V ! \         P                  ! \        ^R,          R7      ^^
RR7      4      pV ! \         P                  ! \         P                  ! V4      ^\	        V4      ^,
          RR7      4      p\        \        P                  V^4      pV Uu. uF  qDV9  g   K  VNK  	  upo	S	'       g   Q hV'       g   Q hV ! \         P                  ! ^^R7      P                  V	3R l4      4      pV Uu. uF  p\        \        P                  V^4      NK   	  ppV ! \         P                  ! ^ \	        V4      R7      4      pVP                  W4       V# u upi u upi )zI
Strategy that returns lists of numbers that don't have a common factor.
r~   r{   T)r   r   uniquerh   c                    < \         P                  ! \         P                  ! \         P                  ! S4      ^R7      ^V R7      # r   r   )r   leftover_primess   &r   rn   $st_comp_no_com_fac.<locals>.<lambda>   s+    bhh9BGr   )rp   r   ry   rv   lenr   r   r   rq   r   insert)
rs   r   uncom_fac_primes	uncom_facinumber_primesr   numbers	insert_atr   s
   &        @r   st_comp_no_com_facr      s+   
 
3'!b	
F 
OOF#[1_		
 x||%5q9I #)F&Q5E,Eqq&FO? 
a2.66	
M :GGvhllD!,GGR[[1GEFINN9(N+ G" Hs   E#E5$Esuppress_health_checki  deadlinez--fastmax_examplesc                   b   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tRtV tR# )TestIsPrimei  c                ,    \        ^4      '       g   Q hR# )   Nr   rH   s   &r   test_very_small_prime!TestIsPrime.test_very_small_prime  s    |||r   c                ,    \        ^4      '       d   Q hR# )   Nr   rH   s   &r   test_very_small_composite%TestIsPrime.test_very_small_composite  s    B<<<r   c                ,    \        R 4      '       g   Q hR# )i[Nr   rH   s   &r   test_small_primeTestIsPrime.test_small_prime  s    	""""r   c                ,    \        R 4      '       d   Q hR# )i(  Nr   rH   s   &r   test_special_composite"TestIsPrime.test_special_composite  s    E??""?r   c                H    \        ^R,          R,           4      '       g   Q hR# )r#      i)  Nr   rH   s   &r   test_medium_prime_1TestIsPrime.test_medium_prime_1"      3''''r   c                H    \        ^R,          R,           4      '       g   Q hR# )r#   r   i-  Nr   rH   s   &r   test_medium_prime_2TestIsPrime.test_medium_prime_2&  r   r   c                H    \        ^R,          R,           4      '       d   Q hR# )r#   r   i0  Nr   rH   s   &r   test_medium_trivial_composite)TestIsPrime.test_medium_trivial_composite*      AsFUN+++++r   c                H    \        ^R,          R,           4      '       d   Q hR# )r#   r   i/  Nr   rH   s   &r   !test_medium_non_trivial_composite-TestIsPrime.test_medium_non_trivial_composite-  r   r   c                Z    \        \        ^4      R,          R,           4      '       g   Q hR# )r#   i   i  N)r   r   rH   s   &r   test_large_primeTestIsPrime.test_large_prime0  s     A$.////r   c                ,    \        R 4      '       d   Q hR# )l   *i:.S#q.m& Nr   rH   s   &r   test_pseudoprime_base_19$TestIsPrime.test_pseudoprime_base_194  s    >?????r   c                (   \        R P                  RR4      4      p\        V4      '       g   Q h\        ^
4       FO  p\        VRV^,
          ,          ^,           ,          RV^,
          ,          ^,           ,          4      '       d   KN   R# 	  Q R4       h)z29 674 495 668 685 510 550 154 174 642 905 332 730 771 991 799 853 043 350 995 075 531 276 838 753 171 770 199 594 238 596 428 121 188 033 664 754 218 345 562 493 168 782 883  i9  ia  zcomposite not detectedN)intreplacer   r(   )rI   r=   _s   &  r   test_pseudoprime_base_300%TestIsPrime.test_pseudoprime_base_3007  s~     " #*'#r"2	
 {{{rAAA!23sa!e}q7HIJJ  3225r   r   N)r^   r_   r`   ra   r   r   r   r   r   r   r   r   r   r   r   rb   rc   rd   s   @r   r   r     sB      ##((,,0@3 3r   r   c            
       0  a  ] tR tRt o R t]P                  ! ]R4      ]! R/ ]	B ]
! RR.4      ]! ]! 4       4      R 4       4       4       4       t]P                  ! ]R4      ]! R/ ]	B ]
! . RO4      ]! ]! 4       4      R 4       4       4       4       t]! R/ ]	B ]! ]P"                  ! ]P$                  ! ^^R,          R7      ^^R7      4      R	 4       4       tR
 t]! R/ ]	B ]! ]P"                  ! ]P$                  ! ^^R,          R7      ^^R7      4      R 4       4       t]P                  ! ]R4      ]! R/ ]	B ]! ]! 4       4      R 4       4       4       t]P2                  P4                  ]! R/ ]	B ]! ]P$                  ! ^RR7      4      ]
! R4      ]
! R4      R 4       4       4       4       4       tR tR tR tR t]! R/ ]	B ]! ]P$                  ! ^RR7      PA                  R 4      4      R 4       4       t!]! R/ ]	B ]! ]"! 4       4      R 4       4       t#R t$Rt%V t&R# )TestNumbertheoryiL  c                z    \        ^i^^4      ^8X  g   Q h\        . RO4      ^8X  g   Q h\        ^4      ^8X  g   Q hR# )   N)i         rl   rH   s   &r   test_gcdTestNumbertheory.test_gcdM  s=    9j*5>>>675@@@1v{{r   zwHypothesis 2.0.0 can't be made tolerant of hard to meet requirements (like `is_prime()`), the test case times-out on itc                l    \        V4      p^V9   g
   V^8w  g   Q hV F  pW2,          ^ 8X  d   K  Q h	  R# r3   rl   rI   r   r   r   s   &&  r   test_gcd_with_com_factor)TestNumbertheory.test_gcd_with_com_factorR  s8     LG|qAv%%A5A:: r   c                .    \        V4      pV^8X  g   Q hR# r3   rl   )rI   r   r   s   && r   test_gcd_with_uncom_factor+TestNumbertheory.test_gcd_with_uncom_factora  s     LAvvr   i    rh   r   c                L    \        V4      pV F  pW2,          ^ 8X  d   K  Q h	  R# r&   rl   r   s   &&  r   test_gcd_with_random_numbers-TestNumbertheory.test_gcd_with_random_numbersn  s%     LA5A:: r   c                z    \        ^^^4      ^i8X  g   Q h\        . RO4      ^i8X  g   Q h\        ^4      ^8X  g   Q hR# )r   N)r         r   rH   s   &r   test_lcmTestNumbertheory.test_lcm|  s=    1eU#y000$%2221v{{r   c                L    \        V4      pV F  pW#,          ^ 8X  d   K  Q h	  R# r&   r   r   s   &&  r   test_lcm_with_random_numbers-TestNumbertheory.test_lcm_with_random_numbers  s%     LA5A:: r   c                P    Vw  r#\        W#4      pWD,          V,          V8X  g   Q hR # r   r4   )rI   valssquarer   calcs   &&   r   test_square_root_mod_prime+TestNumbertheory.test_square_root_mod_prime  s*     $V3{U"f,,,r   c                |    \        V4      p^pV F   pW4^ ,          V^,          ,          ,          pK"  	  W18X  g   Q hR# r3   )r
   )rI   r-   factorsmultr   s   &&   r   test_factorization#TestNumbertheory.test_factorization  s;      $AaDAaDL D {{r   c                    Rp^e\         9   g   Q h^g\         9   g   Q h\        V4      p^pV F   pW4^ ,          V^,          ,          ,          pK"  	  W18X  g   Q hR# )e   Ni(  r   r
   rI   expr   r   r   s   &    r   test_factorisation_smallprimes/TestNumbertheory.test_factorisation_smallprimes  sZ    k!!!k!!!$AaDAaDL D {{r   c                    RpR \         9  g   Q hR\         9  g   Q h\        V4      p^pV F   pW4^ ,          V^,          ,          ,          pK"  	  W18X  g   Q hR# )i  i  Ni;< r   r   s   &    r   "test_factorisation_not_smallprimes3TestNumbertheory.test_factorisation_not_smallprimes  sZ    ;&&&;&&&$AaDAaDL D {{r   c                ,    \        ^ ^4      ^ 8X  g   Q hR# r&   r   rH   s   &r   test_jacobi_with_zero&TestNumbertheory.test_jacobi_with_zero      a|q   r   c                ,    \        ^^4      ^8X  g   Q hR# r3   r  rH   s   &r   test_jacobi_with_one%TestNumbertheory.test_jacobi_with_one  r  r   i  c                    V ^,          # )r#   r   r   s   &r   rn   TestNumbertheory.<lambda>  s    QUr   c                4   \        V4      p\        V4      '       d   \        4       p\        ^V4       FE  p\        V4      p\	        W3,          V4      ^8X  g   Q hVP                  W3,          V,          4       KG  	  \        ^V4       F(  pWB9  g   K  \        V4      p\	        WA4      R8X  d   K(  Q h	  R# \        V4      p\        ^V4       FG  p^pV F*  pV\	        Wd^ ,          4      V^,          ,          ,          pK,  	  V\	        Wa4      8X  d   KG  Q h	  R# )r   N)r   r   r'   r(   r   r)   r
   )rI   rm   r,   r/   r   r   r5   cs   &&      r   test_jacobiTestNumbertheory.test_jacobi  s     #hC==eGa4ydk3/1444DK#-. & 1c]#AA!!>R/// #
 $C(G1c] AQ4AaD00A !F1N***	 #r   c                x    Vw  r#\        W#4      p^ Tu;8  d	   V8  g   Q h Q hW$,          V,          ^8X  g   Q hR# r&   r   )rI   r   r-   rm   invs   &&   r   test_inverse_mod!TestNumbertheory.test_inverse_mod  s>     ##3}}}}y3!###r   c                ,    ^ \        ^ ^4      8X  g   Q hR# r&   r  rH   s   &r   test_inverse_mod_with_zero+TestNumbertheory.test_inverse_mod_with_zero  s    K2&&&&r   r   Nig i )i  i-  i  l    J)l   5yl   1n
Y)'r^   r_   r`   ra   r   unittest
skipUnless
HC_PRESENTr   HYP_SLOW_SETTINGSr   r   r   r   r   r   rp   r   rq   r   r   r   r|   r   r*   markslowr   r   r   r  r  rr   r  rt   r  r  rb   rc   rd   s   @r   r   r   L  s    
 	 "!"j*%&
!" # ' # 	 "!" 
  ! ! # "!"

KK!q$w7	
 #
 "!"

KK!q$w7	
 #
 	 "!"
 !- " #- [["!"
2;;f56  !  7 # 
!! "!"
2;;d3::?KL+ M #+( "!"
 "#$ $ #$' 'r   r   )i@ iA i)A i/A iEA iSA iYA i]A iA iA iA iA iA iA iA iB iB iB i+B i/B r  )r  r   r   )<r   	functoolsr   sys	unittest2r  ImportErrorhypothesis.strategies
strategiesrp   r*   
hypothesisr   r   r   r   r  numbertheoryr   r	   r
   r   r   r   r   r   r   r   r   gmpy2r   gmpy	BIGPRIMESr  parametrizezipr    r$   r  r1   r6   r9   r>   rB   TestCaserD   	compositert   ry   r|   r   r   HYP_SETTINGSfilter_too_muchtoo_slowargvdictr  r   r   )r=   qs   00r   <module>r4     s     
  #  / /&J   	0 Ys^Yr])KL)Kqf)KL'' 
+  ,  +.4 / 4 
"
  :X.. :0 	 	     M M: + +\ ##-L()
  $Lsxx#%L  & sxx()n%(*n%43(## 43nW'x(( W'K
    J$   	D MsR   H H H(  IHH	H%$H%(I0H99
IIII