ffdZddlZddlmZddlTddlmZddlmZm Z m Z m Z m Z m Z mZGddejZifd Zed krd Zejd dSdS)zSelf-test for Math.NumbersN)list_test_cases)*)Integer)PROBABLY_PRIME COMPOSITEmiller_rabin_test lucas_testtest_probable_primegenerate_probable_primegenerate_probable_safe_primeceZdZddddddddd d dd zdz d f Zd ddddddddddddddddzdz zdfZdZdZd Zd!Zd"Z d#Z d$S)% TestPrimality lEq)8(WRv#%a 9AMo-*7wg;02wQX@CkEf <_fufqsQ$c;Q|n?|TA)ynE'd.(6W-+O`'2_6$_ot`G< 8Pr iClI1t#c|jD]+}|t|dt,|jD]+}|t|dt ,|ttdddS)Nr)primes assertEqualrr compositesr assertRaises ValueError)selfprime composites /builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/SelfTest/Math/test_Primality.pytest_miller_rabinzTestPrimality.test_miller_rabin9s[ J JE   .ua88. I I I I I II   .y!<Lk{T@l  q4}2zn1dY/`93yri r)l vK +.QF:yUc,$tcql!3eYlmkE r?-_Ve+lt#gXvnG;.%yfu&1#93Y2:kr) sieve_based)r+r rrCrypto.Util.numberr9)r/r*p not_primesnpr9r6s r2 test_is_primezTestPrimality.test_is_primeIs9)Ls(Q,  E EA   033^ D D D D  A AB   044i @ @ @ @111111DSD! 2 2A%a((C   S. 1 1 1 1 2 2r4cvtd}||ddS)Ni exact_bits)r r+ size_in_bitsr/r<s r2test_generate_prime_bit_sizez*TestPrimality.test_generate_prime_bit_size^s8 #s 3 3 3 ))3/////r4cd}tdD],}td|}||dzd-dS)Nc|dzdkS)Nrr)numbers r2ending_with_onezATestPrimality.test_generate_prime_filter..ending_with_onecsB;!# #r4r$)rB prime_filterrr)ranger r+)r/rJxqs r2test_generate_prime_filterz(TestPrimality.test_generate_prime_filterbsh $ $ $r ( (A'3!0222A   QVQ ' ' ' ' ( (r4cvtd}||ddS)Nr&rA)r r+rCrDs r2test_generate_safe_primez&TestPrimality.test_generate_safe_primeks8 (C 8 8 8 ))3/////r4N) __name__ __module__ __qualname__r*r,r3r7r?rErPrRrHr4r2rr4sAq!RRRCr_usH&y{{33r4suite) defaultTest)__doc__r]Crypto.SelfTest.st_commonrCrypto.Util.py3compatCrypto.Math.NumbersrCrypto.Math.Primalityrrrr r r r TestCaserrZrSr`mainrHr4r2ris D! 555555####''''''                  9090909090H%909090v  z 3 3EHMg&&&&&&r4