python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_hashlib.cpython-312.opt-1.pyc

ΑeպFddlZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZmZddlmZddlmZddlmZddlmZdd	lmZhd
Ze	j4dZeeZnJej9dj;j=d
Dchc]}|j9c}ZeddgZeek(reddgZ ndZ 	ddl!m"Z"m#Z#m$Z$m%Z%	ddl(Z(ejRe(dZ*ejVdZ,ejRe,dZ-dZ.dZ/dZ0GddejbZ2GddejbZ3e4dk(rejjyycc}w#e&$rdZ"dZ#e'Z$dZ%YwxYw#e&$rdZ(YwxYw) N)	unhexlify)support)_4G
bigmemtest)import_fresh_module)	os_helper)requires_resource)threading_helper)
HTTPException>md5sha1sha3blake2sha256sha512PY_BUILTIN_HASHLIB_HASHES",hashlib_hashlib)fresh)blocked)HASHHASHXOFopenssl_md_meth_names
get_fips_modecyNrrE/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_hashlib.pyrr6sr zrequires _blake2T)ubzrequires _sha3cJd}d}|D]}|||dz	dz||dzzz
}|S)N0123456789abcdefr)shris    r!hexstrr,FsDA
A
,	QQ#~
1s7
++,Hr z(http://www.pythontest.net/hashlib/{}.txtc#Ktj|}	tj|d}|5|D]V}|j}|jds|s'|jd}tj|d|d<|X	dddy#tt
f$r%t
jdj|wxYw#1swYyxYww)Nzutf-8)encodingzCould not retrieve {}#rr)
URLformatropen_urlresourceOSErrorrunittestSkipTeststrip
startswithsplitbytesfromhex)	hash_nameurltestdatalinepartss     r!read_vectorsr@Qs

**Y
CE++C'B
	D::<Ds#4JJsOE}}U1X.E!HK
	
]#E 7 > >s CDDEs3CBCAC	C4CCCCceZdZdZddhZejdk(xsejZ	dZ
fdZedZ
edZd	Zd
ZdZdZd
ZdZdZdZdZdZdZdZeddZeddZdbdZdZdZ dZ!e"dZ#e$dZ%		dcd Z&d!Z'e$d"Z(d#Z)e$d$Z*e"d%Z+d&Z,d'Z-d(Z.e/j`e1jde3d)zkd*e4e3d)zd+d,d-Z5e/j`e1jde3d+z
kd*e4e3d+z
d+d,d.Z6d/Z7d0Z8d1Z9d2Z:d3Z;d4Z<d5Z=d6Z>d7Z?d8Z@d9ZAd:ZBd;ZCd<ZDd=ZEd>ZFd?ZGd@ZHdAZIdBZJdCZKdDZLe"dEZMe"dFZNe"dGZOe"dHZPe"dIZQe"dJZRe"dKZSe"dLZTe"dMZUe"dNZVe$dOZWe$dPZXe$dQZYe$dRZZe$dSZ[e$dTZ\e$dUZ]e$dVZ^dWZ_dXZ`dYZadZZbd[Zcedjedjd\Zgd]Zhejd^Zje/jeldud_d`ZmdaZnxZoS)dHashLibTestCase)rMD5r
SHA1sha224SHA224rSHA256sha384SHA384rSHA512blake2bblake2ssha3_224sha3_256sha3_384sha3_512	shake_128	shake_256rQrRposixc	tj|S#t$r6}|jr |tvrtjd|Yd}~yd}~wwxYw)z@Import a module and return a reference to it or None on failure.z#Did a C extension fail to compile? N)	importlib
import_moduleModuleNotFoundError_warn_on_extension_importbuiltin_hasheswarningswarn)selfmodule_nameerrors   r!_conditional_import_modulez*HashLibTestCase._conditional_import_modulensS	M**;77"	M--+2O

 CE7KL	Ms	A,AAct}jD]!}|j|j#j	d}|r|jddhi_|D]1}tr|jdrtj|<3jjD];\}}|jtt|d|fd}|j|=j	d}|_|rjt|djt|djjD]1\}}t|d	|zd}	|	s	|	|j|	3fd
}
j	d}|r|
dj	d
}|r|
dj	d}
|
r |
d|
d|
d|
d|r|
d|
dtsCj	d}|r0|
d|
d|
d|
d|
d|
dt!t"J|i|y#t$rYwxYw)N_blake2rKrLsha3_c`|tj|fi|Stj||fi|SN)rnew)data_algkwargss   r!_test_algorithm_via_hashlib_newzAHashLibTestCase.__init__.<locals>._test_algorithm_via_hashlib_news1<";;t6v66{{4888r ropenssl_md5openssl_sha1openssl_cnttd|}j|j|y)N__get_builtin_constructor)getattrrconstructors_to_testadd)nameconstructorr\s  r!add_builtin_constructorz9HashLibTestCase.__init__.<locals>.add_builtin_constructors0G''+FGMK%%d+//<r _md5r_sha1r
_sha2rErrHr_sha3rMrNrOrPrQrR)setsupported_hash_namesrqlowerr_updaterp	SKIP_SHA3r7itemsrorr
assertTruehasattr
ValueErrorsuperrB__init__)r\argsrh
algorithms	algorithmraconstructorsrirrsrtrurvrwrx	__class__s`              r!rzHashLibTestCase.__init__wstU
22	.INN9??,-	.11)<y)45$&!#	9IY11':365D%%i0	9(,'@'@'F'F'H	>#I|WWi8959	
9
<=
	>22:> 

OOGHm<=OOGHn=>+/+D+D+J+J+L	
6'	<%h
90DdK6#
%((5	
6	=..v6#E*//8#F+//8#H-#H-#H-#H-#I.#I.33G<E'
3'
3'
3'
3'4'4
ot-t>v>I&s<I33	J?Jct|jj}tjj	|Srd)rpvalues	itertoolschain
from_iterable)r\rs  r!hash_constructorsz!HashLibTestCase.hash_constructorss+00779,,\::r ctSrd)rr\s r!is_fips_modezHashLibTestCase.is_fips_modes
r ctjdtd}|jD]F}||d}|j|jvr|jd7|jHy)Nb
Fusedforsecurity)arrayrangerrrshakes	hexdigest)r\aconscs    r!test_hash_arrayzHashLibTestCase.test_hash_arrays[KKU2Y'**	DQ.Avv$B
	r cx|jtjtd|jDy)Nc3@K|]}|jr|ywrd)islower).0_algos  r!	<genexpr>z=HashLibTestCase.test_algorithms_guaranteed.<locals>.<genexpr>s &%]]_&s)assertEqualralgorithms_guaranteedryrzrs r!test_algorithms_guaranteedz*HashLibTestCase.test_algorithms_guaranteeds266&4#<#<&
&	'r c&|jttjj	tj
|j
dtj
tj
D]}tj|d}y)N	undefinedFr)rryrrissubsetalgorithms_availableassertNotInre)r\rrdigests   r!test_algorithms_availablez)HashLibTestCase.test_algorithms_availablesiG99:$HW%A%AB	D	
g&B&BC00	>D[[u=F	>r ctjdd|jr|jd|jD]}|d|ddtjddtj
d|j:|jjdd|jjdyy)NrTrzskip in FIPS moder r)rrerskipTestrrrrjr\rs  r!test_usedforsecurity_truez)HashLibTestCase.test_usedforsecurity_truesHd3MM-.**	,D&d+	,	E40D)==$MMeT:MM%%d%;%r c`tjdd|jD]}|d|ddtjddtjd|j:|jjdd|jjdyy)NrFrr r)rrerrrrjrs  r!test_usedforsecurity_falsez*HashLibTestCase.test_usedforsecurity_falsesHe4**	-D'e,	-	E51E*==$MMeU;MM%%e%<%r c|jttjd|jttjdy)Nzspam spam spam spam spam)assertRaisesrrre	TypeErrorrs r!test_unknown_hashz!HashLibTestCase.test_unknown_hashs/*gkk3MN)W[[!4r cb|jtjdjdy)NrGr)rrrerrrs r!test_new_upper_to_lowerz'HashLibTestCase.test_new_upper_to_lowers!X.33X>r cttd}ttd}|jt|d	ddl}dtjd<|j	|jt|ddtvrtjd<ntjd=	|jt|d|d}|j|j|jt|d	dgy#t
$r|j
dYwxYw#dtvrtjd<wtjd=wxYw)
Nrn__builtin_constructor_cachetestrz_md5 module not availablerurrC)rorrrruImportErrorrsysmodulesclearlocalsrassertIsrrsorted)r\get_builtin_constructorbuiltin_constructor_cacherurss     r!test_get_builtin_constructorz,HashLibTestCase.test_get_builtin_constructors%")'*E#G$+G,I%K!*&=vF	7#F!'')	(j*A5I!&*F#KK')%<a@-e4

k488, 9:UENK!	7MM56	7!&*F#KK'sD!D#D D #3Ec|jD]}|d}|j|jvr_|j|j	dt
|j
t|j	d|jd|j|j	t
|j
t|j	|jy)NFrr)	rrrrassertIsInstancerr9rr,rr\rr)s   r!test_hexdigestzHashLibTestCase.test_hexdigests**	DDU+Avv$%%ahhrlE:  !5q{{2G%%ahhj%8  
!3Q[[]C	Dr c	d}|jD]}|d}|j|jvr%tt	|tr<|j
|jfD]L}|jt|d|D].}|jttf5||ddd0Ny#1swY?xYw)N)i ll
lll
Fri)
rrrrr
isinstancerrrr
OverflowError)r\large_sizesrr)rlengths      r!test_digest_length_overflowz+HashLibTestCase.test_digest_length_overflow$sL**	'DU+AvvT[[(Jq$$7((AKK/
'!!*fc:)'F**J
+FG'v'''
'	'''s	B5	5B>
c|jD]}|d}|j|jt|j|jvr'|j|j|jn&|j
|j|j|j|jtj|jdjy)NFr)
rrrrstrrzassertInrrrrers   r!test_name_attributez#HashLibTestCase.test_name_attribute4s**
	DU+A!!!&&#.vv222

affd&?&?@  )B)BCAFFE:??

	r c@d}d}d}d}|jD]}|d}|j||j||j||j||j|jvrd}nd}|d}|j||z|z|z|j	|j
||j
||||z|z|zd}	|j	|j
||	j
||||z|zd}
|
j
|}|
j
}|j||j	|j
||j
||j	|
j
||y)	Nsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbs~ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddFr)rr)rr|rrrrrcopy)
r\aasbeesceesdeesrm1rm2m3m4	m4_digestm4_copys
             r!test_large_updatez!HashLibTestCase.test_large_updateAs**	:De,BIIcNIIdOIIdOIIdOww$++%e,BIIcDj4'$./YRYY-yryy$/?@cDj4'$.FBYRYY-yryy$/?@cDj4'?B!		4(IggiGNN4 YRYY-~w~~t/DEYRYY-y91	:r cpucddz}tj}tddD]}|j||jd|j	|jdy)Nrhello world@a5364f7a52ebe2e25f1838a4ca715a893b6fd7a23f2a0d9e9762120da8b1bf53)rrrr|rrr\zero_1mbr)r+s    r!test_sha256_update_over_4gbz+HashLibTestCase.test_sha256_update_over_4gbas\$&NNq$	A
HHX		 (jkr cddz}tj}tddD]}|j||jd|j	|jdy)Nrrrrr@e2d4535e3b613135c14f2fe4e026d7ad8d569db44901740beffa30d430acb038)rrNrr|rrrs    r!test_sha3_256_update_over_4gbz-HashLibTestCase.test_sha3_256_update_over_4gbjs^$&q$	A
HHX		 (jkr Fcvt|dz}|j}|j|}|jt|d|D]}||fi|}	|s|	j	n|	j	|}
|j|
|d|||
t||fz|s|	j
n|	j
|}
tj|}|j|
||r|jt||	j|s&|jd|j|||yyy)NzrHash algorithm %s constructed using %s returned hexdigest %r for %d byte input data that should have hashed to %r.key)lenr{rpassertGreaterEqualrrrr9r:digest_sizegetcheck_file_digest)r\rrrfrshakerhrrhash_object_constructormcomputedrs            r!checkzHashLibTestCase.checkss+Y"OO%	006L 115'3
	=#'77A,1q{{}q{{67JHiP4TI77
8*/qxxzAHHV4DH]]9-FXv.  Vamm<
	=E*2""4y93ur cV|j}	tj||g}|j	|j
|t
tjd5}|j|ddd	|D]}tj|}|jd|jtj||j|t
tjd5}tj||}ddd|jj|	t!j"tjy#t$rYywxYw#1swYxYw#1swYkxYw#t!j"tjwxYw)Nwbrrb)r{rrerextendrpopenrTESTFNwriteioBytesIOseekrfile_digestrosunlink)	r\rrrfrdigestsfrbuf	digestobjs	         r!rz!HashLibTestCase.check_file_digestsZOO%		KK&t0067
)""D
)	Q
GGDM		(!
Cjj&  ''V4>>@))**D1?Q ' 3 3Av >I?  !4!4!6	B
C
IIi&&')				??
IIi&&'sBE"E+=A9F6E7
*F	E('E(+E47F	<F%F(c^|j|}|D]}|jt|dy)Nspam)rprr)r\algorithm_namerrs    r!check_no_unicodez HashLibTestCase.check_no_unicodes700@'3	J#i)@&I	Jr c|jd|jd|jd|jd|jd|jdy)Nrr
rErrHrrrs r!test_no_unicodezHashLibTestCase.test_no_unicodesVe$f%h'h'h'h'r cH|jd|jdy)NrKrLrrs r!test_no_unicode_blake2z&HashLibTestCase.test_no_unicode_blake2si(i(r c|jd|jd|jd|jd|jd|jdy)NrMrNrOrPrQrRrrs r!test_no_unicode_sha3z$HashLibTestCase.test_no_unicode_sha3sVj)j)j)j)k*k*r Nc|j|}|D]J}|d}|j|j||j|j||rX|jt	|j|||jt	|j
|d|znU|jt	|j||jt	|j
d|z|j|j||j|jddt|jMy)NFrr_r)rpr
block_sizerrrrrrrr8reprr{)r\rrrr
digest_lengthrrrs        r!check_blocksize_namez$HashLibTestCase.check_blocksize_names006'3	?#'>AQ\\:6Q]]K8  QXXm%<!=!.0  Q[[%?!@!"=2  QXXZ+>  Q[[]!3Q{]CQVVT*MM$**S/!,d1gmmo>	?r c|jddd|jddd|jddd|jddd	|jd
dd|jd
ddy)Nr@rr
rEr rH0rr!rs r!test_blocksize_and_namez'HashLibTestCase.test_blocksize_and_namesn!!%R0!!&"b1!!(B3!!(B3!!(C4!!(C4r c|jddd|jddd|jddd	|jd
dd|jd
ddd|jddddy)NrMr%rNr&rOhr(rPHr#rQrrRr)rs r!test_blocksize_name_sha3z(HashLibTestCase.test_blocksize_name_sha3sr!!*c26!!*c26!!*c26!!*b"5!!+sAr:!!+sAr:r c>|j|}|D]}|}tt|tr!|j||zd|j|j||j|j
||j|j|y)Ni@)rprrr_capacity_bits
_rate_bits_suffix)r\rrcapacityratesuffixrrrs        r!
check_sha3zHashLibTestCase.check_sha3s006'3	0#')AJq$$7X_d3Q--x8Q\\40QYY/	0r c|jdddd|jdddd|jdd	d
d|jddd
d|jdddd|jddddy)NrMiirNi@rOii@rPri@rQi@rR)r9rs r!test_extra_sha3zHashLibTestCase.test_extra_sha3sn
Cw7
Cw7
Cg6
D#w7S$8S$8r cP|jddd|jdddy)NrKr'r#rLr&r)rs r!test_blocksize_name_blake2z*HashLibTestCase.test_blocksize_name_blake2s&!!)S"5!!)R4r c.|jddddy)Nrr  d41d8cd98f00b204e9800998ecf8427eFrrrs r!test_case_md5_0zHashLibTestCase.test_case_md5_0s

3:!		
r c.|jddddy)Nrabc 900150983cd24fb0d6963f7d28e17f72FrrDrs r!test_case_md5_1zHashLibTestCase.test_case_md5_1s

6=!		
r c.|jddddy)Nrs>ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 d174ab98d277d9f5a5611c2c9f419d9fFrrDrs r!test_case_md5_2zHashLibTestCase.test_case_md5_2s

M.!			
r z!test cannot run on 32-bit systemsr)sizememusedry_runc0|jdd|zdy)NrA c9af2dff37468ce5dfee8f2cfc0a9c6drDr\rNs  r!test_case_md5_hugez"HashLibTestCase.test_case_md5_huge	

5$t)%GHr c0|jdd|zdy)NrrR 28138d306ff1b8281f1a9067e1a1a2b3rDrTs  r!test_case_md5_uintmaxz%HashLibTestCase.test_case_md5_uintmaxrVr c*|jdddy)Nr
r (da39a3ee5e6b4b0d3255bfef95601890afd80709rDrs r!test_case_sha1_0z HashLibTestCase.test_case_sha1_0"s

63=	?r c*|jdddy)Nr
rG(a9993e364706816aba3e25717850c26c9cd0d89drDrs r!test_case_sha1_1z HashLibTestCase.test_case_sha1_1&s

66=	?r c*|jdddy)Nr
8abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq(84983e441c3bd26ebaae4aa1f95129e5e54670f1rDrs r!test_case_sha1_2z HashLibTestCase.test_case_sha1_2*s

6N=	?r c0|jdddzdy)Nr
a@B(34aa973cd4c4daa4f61eeb2bdbad27316534016frDrs r!test_case_sha1_3z HashLibTestCase.test_case_sha1_3/s

64'>=	?r c*|jdddy)NrEr 8d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42frDrs r!test_case_sha224_0z"HashLibTestCase.test_case_sha224_08s

8S
D	Fr c*|jdddy)NrErG823097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7rDrs r!test_case_sha224_1z"HashLibTestCase.test_case_sha224_1<s

8V
D	Fr c*|jdddy)NrEra875388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525rDrs r!test_case_sha224_2z"HashLibTestCase.test_case_sha224_2@s

8
E
D	Fr c0|jdddzdy)NrErerf820794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67rDrs r!test_case_sha224_3z"HashLibTestCase.test_case_sha224_3Es

8TG^
D	Fr c*|jdddy)Nrr @e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855rDrs r!test_case_sha256_0z"HashLibTestCase.test_case_sha256_0Js

8S
L	Nr c*|jdddy)NrrG@ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015adrDrs r!test_case_sha256_1z"HashLibTestCase.test_case_sha256_1Ns

8V
L	Nr c*|jdddy)Nrra@248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1rDrs r!test_case_sha256_2z"HashLibTestCase.test_case_sha256_2Rs

8
E
L	Nr c0|jdddzdy)Nrrerf@cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0rDrs r!test_case_sha256_3z"HashLibTestCase.test_case_sha256_3Ws

8TG^
L	Nr c*|jdddy)NrHr `38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95brDrs r!test_case_sha384_0z"HashLibTestCase.test_case_sha384_0\s

8S-	.r c*|jdddy)NrHrG`cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7rDrs r!test_case_sha384_1z"HashLibTestCase.test_case_sha384_1as

8V-	.r c*|jdddy)NrHpabcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu`09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039rDrs r!test_case_sha384_2z"HashLibTestCase.test_case_sha384_2fs

8O-	.r c0|jdddzdy)NrHrerf`9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985rDrs r!test_case_sha384_3z"HashLibTestCase.test_case_sha384_3ms

8TG^-	.r c*|jdddy)Nrr ڀcf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3erDrs r!test_case_sha512_0z"HashLibTestCase.test_case_sha512_0ss

8SM	Nr c*|jdddy)NrrGڀddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49frDrs r!test_case_sha512_1z"HashLibTestCase.test_case_sha512_1xs

8VM	Nr c*|jdddy)Nrrڀ8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909rDrs r!test_case_sha512_2z"HashLibTestCase.test_case_sha512_2}s

8OM	Nr c0|jdddzdy)Nrrerfڀe718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09brDrs r!test_case_sha512_3z"HashLibTestCase.test_case_sha512_3s

8TG^M	Nr c|j|j|t|dzD]}|d|zd|dzz}|jt|||j|j
|t|dzD]}|d|zd|dzz}	|jt||	|j|j|td|dzD]}||
|jt|d|jt|d|jt||dz|j|j|t|dzD]}|d|zd|dzz}
|jt||
|j|j|d	jtdd
D]}||
|jt|d|jt|d
tdd
D]}||
|jt|d|jt|d|jt|d
tdd
D]}||

|jt|d
|jt|d

td|dzD]}||
|jt|d|jt||dz|d|d|jt|d|jt|d|d|||jt|d|jt||dz|jt|d	|jt|d	|jt|d|d	d	d	d	dddd
ddddy)Nrresalt)personrrrr r=)fanout)depth)
node_depth)
inner_size)	leaf_sizel)node_offset)rf)stringr%r<T)rrrrrrrrrr	last_node)r	SALT_SIZErrrPERSON_SIZEMAX_DIGEST_SIZEMAX_KEY_SIZErrr)r\rs	salt_sizeperson_sizekey_sizer
max_offsetr+rrrs           r!check_blake2zHashLibTestCase.check_blake2s..	:y1}%	'ATAX&	'y1}%*k=00+>{1}%	)Atax(	)q)*k&A44kBq+/*	'AA&	'*krB*kqA*k{1}M118<xz"	&AD1H%	&hl#*ks;002$-779	;q#	"Aq!	"*k"=*k#>q#	!Aa 	!*k<*k;*k=q#	&A1%	&*kbA*kcBq+/*	&A1%	&*kbA*kk!mLa i(*kR@-F"
+*krB-*Q,O)[s;)[=)["5
	
r c d}|d}|D]n}|D]g}|||}|||}	|||}
|j|
j|||	|}|j|jip|jS)Ncd}d|z|z}d}t|}t|D]}||z|z}||}}|dz	dz||<|S)NrlKZ=r)	bytearrayr)rseedmaskrroutr+ts        r!selftest_seqz4HashLibTestCase.blake2_rfc7693.<locals>.selftest_seqsgDd"d*AAF#C6]
*UdN!1r'T)A
*Jr r&r)rr)r|rr)r\rsmd_lenin_lenrouteroutleninlenindatarunkeyedkeyeds            r!blake2_rfc7693zHashLibTestCase.blake2_rfc7693s		+	-F
-%eU3"662%f&AW^^-.#FHU\\^,

-	-  r c|jtjdddddgd}gd}|j|j	tj||dy)Nrr#l)r$r&r(r#)rrr'rr@c23a7800d98123bd10f506c61e29da5603d763b8bbad2e737f5e765a7bccd475)rrrKrr)r\
b2b_md_len
b2b_in_lens   r!test_blake2bzHashLibTestCase.test_blake2bsP'//2r2r9E%
0
ZHN	Pr c*|jdddy)NrKr ڀ786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2cerDrs r!test_case_blake2b_0z#HashLibTestCase.test_case_blake2b_0s

9cM	Nr c*|jdddy)NrKrGڀba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923rDrs r!test_case_blake2b_1z#HashLibTestCase.test_case_blake2b_1s

9fM	Nr cB|jddddddddd	d
ddd
dy)NrKfoo 920568b0c5873b2f0ab67bedb6cf1b2brbarbazbingrrr&rMrTrrrrrrrrrrrrDrs r! test_case_blake2b_all_parametersz0HashLibTestCase.test_case_blake2b_all_parameters=	

9f
,		r ctdD]0\}}}tj|}|jd|||2y)NrKrr@r9r:rr\msgrmds    r!test_blake2b_vectorsz$HashLibTestCase.test_blake2b_vectors>(3	4LCb--$CJJy#rsJ3	4r c|jtjdddddgd}gd}|j|j	tj||dy)Nr&l)rr$r%r&)rrr#Arr@6a411f08ce25adcdfb02aba641451cec53c598b24f4fc787fbdc88797f4c1dfe)rrrLrr)r\
b2s_md_len
b2s_in_lens   r!test_blake2szHashLibTestCase.test_blake2ssP'//1aRC%
.
ZHN	Pr c*|jdddy)NrLr @69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9rDrs r!test_case_blake2s_0z#HashLibTestCase.test_case_blake2s_0$s

9c
L	Nr c*|jdddy)NrLrG@508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982rDrs r!test_case_blake2s_1z#HashLibTestCase.test_case_blake2s_1)s

9f
L	Nr cB|jddddddddd	d
ddd
dy)NrLr bf2a8f7fe3c555012a6f8046e646bc75rrrrrrr&rMrrTrrDrs r! test_case_blake2s_all_parametersz0HashLibTestCase.test_case_blake2s_all_parameters.rr ctdD]0\}}}tj|}|jd|||2y)NrLrrrs    r!test_blake2s_vectorsz$HashLibTestCase.test_blake2s_vectors@rr c*|jdddy)NrMr 86b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7rDrs r!test_case_sha3_224_0z$HashLibTestCase.test_case_sha3_224_0Fs

:s
D	Fr cPtdD]\}}|jd||y)NrMr@rr\rrs   r!test_case_sha3_224_vectorz)HashLibTestCase.test_case_sha3_224_vectorK*#J/	,GCJJz3+	,r c*|jdddy)NrNr @a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434arDrs r!test_case_sha3_256_0z$HashLibTestCase.test_case_sha3_256_0Ps

:s
L	Nr cPtdD]\}}|jd||y)NrNrrs   r!test_case_sha3_256_vectorz)HashLibTestCase.test_case_sha3_256_vectorUrr c*|jdddy)NrOr `0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004rDrs r!test_case_sha3_384_0z$HashLibTestCase.test_case_sha3_384_0Zs

:s-	.r cPtdD]\}}|jd||y)NrOrrs   r!test_case_sha3_384_vectorz)HashLibTestCase.test_case_sha3_384_vector`rr c*|jdddy)NrPr ڀa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26rDrs r!test_case_sha3_512_0z$HashLibTestCase.test_case_sha3_512_0es

:sM	Nr cPtdD]\}}|jd||y)NrPrrs   r!test_case_sha3_512_vectorz)HashLibTestCase.test_case_sha3_512_vectorkrr cT|jdddd|jddddy)NrQr @7f9c2ba4e88f827d616045507605853ed73b8093f6efbc88eb1a6eacfa66ef26T7f9crDrs r!test_case_shake_128_0z%HashLibTestCase.test_case_shake_128_0p,

;
L
		

;VT2r cRtdD]\}}|jd||dy)NrQTrrs   r!test_case_shake128_vectorz)HashLibTestCase.test_case_shake128_vectorv,#K0	3GCJJ{CT2	3r cT|jdddd|jddddy)NrRr @46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b81b82b50c27646ed5762fT46b9rDrs r!test_case_shake_256_0z%HashLibTestCase.test_case_shake_256_0zrr cRtdD]\}}|jd||dy)NrRTrrs   r!test_case_shake256_vectorz)HashLibTestCase.test_case_shake256_vectorrr c4d}|jD]_}|d}|jd|jd|z|jd|d|zd}|jdatj}|jd|jd|z|jd|j	|jdtjdd|zzdz}|j	|jdy)NiFr1#x@1cfceca95989f51f658e3f3ffe7f1cd43726c9e088c13ee10b46f57cef135b94)rr|rrrr)r\gil_minsizerrs    r!test_gilzHashLibTestCase.test_gils**	DU+A
HHTN
HHTK'(
HHTNTK'?A
HHTN	
NN		#$	
KKMN	


NN4$"44t;<
KKMN	
r c.	
tj
d}d}|dz	tj	|zj}	
fd}g}t|D]l}t		d|zz}|j|d|j
|t	|zdtj||f}|j|n|D]}|j|D]}|j|j
|
jy)NrMsswineflui@
c~d}|tkr,j|||z||z
}|tkr+yyr)rr|)
chunk_sizeindexrfhashers  r!hash_in_chunksz=HashLibTestCase.test_threaded_hashing.<locals>.hash_in_chunkssDE#d)#

d5);<=##d)#r rr)targetr)rr
rrr
assertGreaterr	threadingThreadappendstartjoin)r\num_threads
smallest_data
expected_hashr(threads	threadnumr%threadrfr's         @@r!test_threaded_hashingz%HashLibTestCase.test_threaded_hashings#
v%T+%56@@B
	${+	#ITrY7Jz1-Z#m*<<a@%%^,6=:FNN6"
	#	FLLN		FKKM		
(8(8(:;r cN|j}||j|tyyrd)rrint)r\	fips_modes  r!test_get_fips_modez"HashLibTestCase.test_get_fips_modes(%%	 !!)S1!r c	4|jjD]`\}}|jdr|D]D}	|}|j	|5tj|t|dddFby#t$rYUwxYw#1swYbxYw)N)rbrblake)rs)rpr~r7rsubTestrcheck_disallow_instantiationtype)r\rrrsr)s     r!test_disallow_instantiationz+HashLibTestCase.test_disallow_instantiations'+'@'@'F'F'H	H#I|##$?@+
H#
A\\k\:H88tAwGHH

H	H"HHsA? B?	B
BBz
need _hashlibcltj|ttj|tyrd)rr>rrrs r! test_hash_disallow_instantiationz0HashLibTestCase.test_hash_disallow_instantiations$	,,T48,,T7;r c	H|jjD]^\}}|D]T}	t|}|j	|5|jtd5d|_ddddddV`y#t$rYewxYw#1swY%xYw#1swY~xYw)N)	hash_typezimmutable typeF)rpr~r?rr=assertRaisesRegexrvalue)r\rrrsrDs     r!test_readonly_typesz#HashLibTestCase.test_readonly_typess'+'@'@'F'F'H
	0#I|+
0 $[] 3I\\I\60//	;KL0*/	000

0
	0"0000s5A=	B B	(B=	B	B	B
BB!)F)rrN)p__name__
__module____qualname__rzrrrrrPy_DEBUGrXr_rpropertyrrrrrrrrrrrrrrr	rrrrrrrequires_blake2r
requires_sha3rr!r*r1r9r?rArErIrLr4skipIfrmaxsizerrrUrYr\r_rcrhrkrnrqrtrwrzr}rrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrr"r
reap_threadsrequires_working_threadingr6r:cpython_onlyr@
skipUnlessrrBrG
__classcell__)rs@r!rBrBas7;
'F"$G!3!Gw7G7GI?V;;'
><	=5?L4D' :@ullull:2(4J())++DE+/?&5;;
09955


X__S[[37*,OPS1WQ6I7QIX__S[[37*,OPS1WQ6I7QI???
?FFF
F
NNN
N
.
.
..N
N
NN
M
^!,PPNN
NN
"44
PPNNNN"44
FF,,NN,,..
,,NN
,,3333
:""0002!<3#!<F2


H
HXT)?;<<<
0r rBc
NeZdZgdZdddddedfdddd	ded
fddd
d	dedfgZejddfejddfejddfejddfejddfgejddfejddfejddfejddfejddfgejddfejddfejddfejdd fejd!dfgd"Zd#Z	e
jedud$d%Z
e
jeed&d'e
jed()d*Zd+Zd,Zy)-KDFTests))passwordsaltrN)rXrYrN)rXrYrN)spasswordPASSWORDpasswords$saltSALTsaltSALTsaltSALTsaltSALTsaltrr)s	passwordssaltrrr rrڀ77d6576238657b203b19ca42c18a0497f16b4844e3074ae8dfdffa3fede21442fcd0069ded0948f8326a753a0fc81f17e8d3e0fb2e0d3628cf35e20c38d18906rXsNaClrrڀfdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640s
pleaseletmeinsSodiumChloridei@ڀ7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2d5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887(0c60c80f961f0e71f3a9b524af6012062fe037a6N(ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957(4b007901b765489abead49d926f721d065a429c123d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038 56fa6aa75548099dcc37d7f03425e0c3@120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b@ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43@c5e478d59288c841aa530db6845c4c8d962893a001ce4e11a4963873aa98134aP348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9( 89b69d0516f829893c696226650a8687ڀ867f70cf1ade02cff3752599a3a53dc4af34c7a669815ae5d513554e1c8cf252c02d470a285a0501bad999bfe943c08f050235d7d68b1da55e63f73b60a57fceڀe1d9c16aa681708a45f5c7c4e215ceb66e011a2e9f0040713f18aefdb866d53cf76cab2868a39b9f7840edce4fef5a82be67335c77a6068e04112754f27ccf4eڀd197b1b33db0143e018b12f3d1d1479e6cdebdcc97c5c0f87f6902e072f457b5143f30602641b3d55cd335988cb36b84376060ecd532e039b742a239434af2d5ڀ8c0511f4c6e597c6ac6315d8f0362e225f3c501495ba23b868c005174dc4ee71115b59f9e60cd9532fa33e0f75aefe30225c583a186cd82bd4daea9724a3d3b8r# 9d9e9c4cd21fe4be24d5b8244c759665)r
rrc|jjD]\}}||vrt|jD]\}}|\}}}	}
||\}}|r|}
|||||	|
}
|j	|
|||||	|
f||t|t||	|
}
|j	|
|||t
|t
||	|
}
|j	|
||
|||||	}
|j	|
|||||	f|jtd5|dddddddd|vr|jt|dddd|jt|ddd	d|jt|dddd
|jt|dddd|jt|ddddd
|jt|ddddd|ddddd
}
|j	|
|jdd
d
yy#1swYxYw)Nz.*unsupported.*unknownspassrYrr
ssha1passrrrrX)r;passwordr
iterationsdklen)pbkdf2_resultsr~	enumeratepbkdf2_test_vectorsr
memoryviewrrErrr)r\pbkdf2	supporteddigest_nameresultsr+vectorrqrroundsrsexpectedoverwrite_dklenrs              r!_test_pbkdf2_hmaczKDFTests._test_pbkdf2_hmac(sk$($7$7$=$=$?	L K)+&t'?'?@
L	606-$,3AJ)/"+E[(D&%H  h"-xvu!MO[*X*>'-vu>  h/[)H*=&t_fe=  h/= hfEC$$S(&18T6%JL!
L	L,
#
#J0A
B	39gw2	3Y67GWa

66661

FFGWa

FFGWb

FFGWa

FFGWa
6KgD*CS$"5"5f"=a"@"CD+	3	3sHH
zrequires OpenSSL bindingscL|jtjtyrd)ropenssl_hashlibpbkdf2_hmacrrs r!test_pbkdf2_hmac_czKDFTests.test_pbkdf2_hmac_cYs::<QRr scryptz   test requires OpenSSL > 1.1zscrypt is blocked in FIPS mode)reasonc
|jD]5\}}}}}}tj|||||}|j||7tjddddd|j	t
5tjdddddddd|j	t
5tjdddddddd|j	t
5tjdddd|j	t
5tjddddd|j	t
5tjddddd	dddd
D]E}|j	ttt
f5tjdd|dddddGdD]E}|j	ttt
f5tjddd|ddddGdD]E}|j	ttt
f5tjdddd|dddGdD]F}|j	ttt
f5tjddddd|
dddHdD]F}	|j	ttt
f5tjddddd|	dddHy#1swYVxYw#1swY+xYw#1swYxYw#1swYxYw#1swYxYw#1swYxYw#1swYxYw#1swYDxYw#1swYxYw#1swYxYw)N)rnr*prXrYrrrrqrr)rrrN)rrN)rN)rrr*rmaxmem)rrr*rrs)scrypt_test_vectorsrrrrrrr)
r\rqrrr*rr~resultrrss
          r!test_scryptzKDFTests.test_scrypt]s2261I1I	/-HdAq!X^^H41QGFVX.	/
	{Aa@


y
)	DNN:GqAC	D


y
)	DNN;VqAC	D

y
)	(NN;'	(


y
)	1NN;0	1


y
)	?NN;1ag>	?!	IA""J
y#IJ
I{AaH
I
I	I	IA""J
y#IJ
I{AaH
I
I	I	IA""J
y#IJ
I{AaH
I
I	I!	.F""J
y#IJ
.{Aa&,.
.
.	. 	,E""J
y#IJ
,{Aa%*,
,
,	,1	D	D	D	D	(	(	1	1	?	?
I
I
I
I
I
I
.
.
,
,sx4K#,K0$K=L
LL$L1'L>1M<M#K-0K:=L
LL!$L.	1L;	>M	M	M!	c|jdtj|jdtjy)N
blake2b512zsha3-512)rrrrs r!test_normalized_namezKDFTests.test_normalized_names.w'C'CDW%A%ABr c,ddz}tj}|jtjt
jtt
jd5}tdD]$}|j||j|&	dddtt
jd5}tj|tj}ddd|j|jj|j|j|j|jt!|t!||j#t$5tjddddd|j#t$5tt
jd5}tj|ddddddd|j#t$5tt
jd5}tj|dddddddy#1swYxYw#1swYrxYw#1swYxYw#1swYxYw#1swYxYw#1swYPxYw#1swYyxYw)Nreirrrrr*)rr
addCleanuprrrrrrr|rr
rrrrrr?rr)r\rfd1rrd2s      r!test_file_digestzKDFTests.test_file_digestse|
^^
		9#3#34
)""D
)	Q2Y
		$

	
)""D
)	8Q$$Q7B	8	
8"''*

d2hR)


z
*	0h/	0

z
*	1i&&,
1##Ax0
1	1

z
*	1i&&-
1##Ax0
1	1	1'		
	8	8	0	0
1
1	1	1

1
1	1	1sl"3I8%I
2I&I2I&I2=J
I>/J
I

II#&I/	+I22I;>J	J

J)rHrIrJrvrrr9r:rtrr4rOrrrTrrrrrrrr r!rWrWsw	

c2q!Y(jk	l	gtQI7y-z	{	,eQ9FH<I	J]]E
FM
]]E
FM
]]E
FM
]]&'(*
,
]]=
>EH]]>?@D
F
]]>?@D
F
]]>?@D
F]]JKLN
P
]]=
>EH]]>?@D
F]]>?@D
F]]>?@D
F]]>?@B
D]]=
>E
H-$NL/EbX___,.IJSKSX(357X__]_-MN#,O7#,JC1r rW__main__)6rbinasciirrrUrrrr	sysconfigr+r4rZrrtest.supportrrtest.support.import_helperrrr	r
http.clientrdefault_builtin_hashesget_config_varrYr6r{r8rbuiltin_hashlibrrrrrr	frozensetrarTrMcheck_sanitizerr}rNr,r0r@TestCaserBrWrHmain)rs0r!<module>rs
		
(:"*)%O)))*EF+N*//4::<BB3G	N&i
|D++))j\JOOLL&(%%g/AB
$G##t,	###	M3CD

1
 K0h''K0\s1x  s1lzHMMOG$DG%KGs**E8#E=0F=FFF F