python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_hmac.cpython-312.opt-2.pyc

Αe9gddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZ	ddl
Zddl
mZddl
mZddl
mZ	ddlZdZGdd	ej2ZGd
dej2ZGdd
ej2ZGddej2ZGddej2Zedk(rej@yy#e$rdZdZdZdZYwxYw#e$rdZYwxYw)N)hashlib_helpercheck_disallow_instantiation)_compare_digest)HMAC)hmac_new)compare_digestcBtjfd}|S)Nctj5tjdt|i|cdddS#1swYyxYw)Nignore)category)warningscatch_warningsfilterwarningsDeprecationWarning)argskwargsfuncs  B/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_hmac.pywrapperzignore_warning.<locals>.wrappersE

$
$
&	)##H-?
A((	)	)	)s#AA)	functoolswraps)rrs` rignore_warningrs%__T))
NceZdZdZdZejdddZejdddZd	Z	ejd
ddZ
ejddd
ZejdddZejdddZ
ejddZdZdZy)TestVectorsTestCasec|j|jj|j|j|jt	j
||j|jd||j|j||j|j|y)Nzhmac-)	assertEqual	hexdigestupperdigestbinascii	unhexlifynamedigest_size
block_size)selfhr hashnamer$r%s      rassert_hmac_internalsz)TestVectorsTestCase.assert_hmac_internals*s	
,,.?X%7%7%?@5
!344z2rcRtj|||}|j|||||tj|||}|j|||||tj||}|j}	|	j	d|j	||j|j
j|jtj|||}|j|||||tj|d|}|j	||j|j
j|jtj||}|j	||j|j
j|jtj|||}|j|j
j|j|jtj|||tj||jtj|||tj|tjjtj}|j||||j|||||t+t|||}|j|||||t||}|j}	|	j	d|j	||j|j
j|jtt d|}
t|||
}|j|||||tjjtj}|j#||||j|||||yy)N	digestmodstest update)r openssl_)hmacrr)copyupdaterrrnewr r!r"__new__	_init_old
c_hmac_newgetattr_hashopenssl
_init_hmac)r&keydatar hashfuncr(r$r%r'h2rs           rassert_hmaczTestVectorsTestCase.assert_hmac3sB
IIc484""
vxj	

IIc484""
vxj	

IIcX.
VVX
		.!	,,.?HHS$(3""
vxj	

HHS$(3	,,.?HHSH-	,,.?HHS$(3,,.?KKT(3v&	
	
KKT(3v&	


IIdii(	C2""
vxj	
!39A&&68[*
3(3ABIIn%
HHTNQ[[]002FLLNC<8H:)>?D35A&&68[*
		!!$)),A
LLdhL7&&68[*
)"rmd5T)opensslcfd}|ddd|ddd|dd	d
|ttddd
d|ddd|ddd|dddy)Nc	Rj|||tjdddy)Nr=@r:r(r$r%)r<hashlibr=r8r9r r&s   rmd5testz5TestVectorsTestCase.test_md5_vectors.<locals>.md5tests-T6 

rHi There 9294727A3638BB1C13F48EF8158BFC9DJefewhat do ya want for nothing? 750c783e6ab0b503eaa86e310a5db738s2 56be34521d144c88dbb8c733f0e8b3f62 697eaf0aca3a3aea3a75164746ffaa79sTest With Truncation 56461ef2342edc00f9bab995690efd4cP6Test Using Larger Than Block-Size Key - Hash Key First 6b1ab7fe4bd7bf8f0b62e6ce61b9d0cdITest Using Larger Than Block-Size Key and Larger Than One Block-Size Data 6f630fad67cda0ee1fb1f562db3aa53ebytesrange)r&rFs` rtest_md5_vectorsz$TestVectorsTestCase.test_md5_vectors}s		2	4	/2	4	2	4	eArl#2	4	'2	4	I2	4	82	4rsha1cfd}|ddd|ddd|dd	d
|ttddd
d|ddd|ddd|dddy)Nc	Rj|||tjdddy)Nr^rBrC)r<rDr^rEs   rshatestz5TestVectorsTestCase.test_sha_vectors.<locals>.shatests-T6 

rrH(b617318655057264e28bc0b6fb378c8ef146be00rJrK(effcdf6ae5eb2fa2d27416d5f184df9c259a7c79rM(125d7342b9ac11cd91a39af48aa17b4f63f175d3rOrPrQ(4c9007f4026250c6bc8414f9bf50c86c2d7235dasrS(4c1a03424b55e07fe7f27be1d58bb9324a9a5a04rUrV(aa4ae5e15272d00e95705637ce8a3b55ed402112rX(e8e99d0f45237d786d6bbaa7965c7808bbff1a91rZ)r&rbs` rtest_sha_vectorsz$TestVectorsTestCase.test_sha_vectorss		:	<	/:	<	:	<	eArl#:	<	':	<	I:	<	8:	<rcfd}|ddtjdtjdtjdtjdi|d	d
tjdtjdtjd
tjdi|ddtjdtjdtjdtjdi|tdt
ddDdtjdtjdtjdtjdi|ddtjdtjd tjd!tjd"i|dd#tjd$tjd%tjd&tjd'iy)(Nc	@|}j|||y)NrC)r<)	r8r9
hexdigestsr r%r$	hash_namer:r&s	    rhmactestz9TestVectorsTestCase._rfc4231_test_cases.<locals>.hmactests3)FT6!"'%

rrcrH8896fb1128abbdf196832107cd49df33f47b4b1169912ba4f53684b22@b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7`afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6ڀ87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854)r8r9rorJrK8a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44@5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843`af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649ڀ164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737rfrM87fb3cb3588c6c1f6ffa9694d7d6ad2649365b0c1f65d69d1ec8333ea@773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe`88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e55966144b2a5ab39dc13814b94e3ab6e101a34f27ڀfa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fbc3 K|]}|ywN).0xs  r	<genexpr>z:TestVectorsTestCase._rfc4231_test_cases.<locals>.<genexpr>s<1Q<srOrPrQ86c11506874013cac6a2abc1bb382627cec6a90d86efc012de7afec5a@82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b`3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffbڀb0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298ddsrV895e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870e@60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54`4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952ڀ80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598sThis is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.83a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1@9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2`6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523eڀe37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58)rDsha224sha256sha384sha512r[r\)r&r:rpr$r%rqs````` r_rfc4231_test_casesz'TestVectorsTestCase._rfc4231_test_casess					z#>>$>>>$F>>$F>>$F	"	w7>>$>>>$F>>$F>>$F	"	z">>$>>>$F>>$F>>$F	"	u<dF(;<<">>$>>>$F>>$F>>$F	"	{2>>$>>>$F>>$F>>$F	$	{4>>$>>>$F>>$F>>$F
	rrcH|jtjdddy)NrrB)rrDrr&s rtest_sha224_rfc4231z'TestVectorsTestCase.test_sha224_rfc4231F  2rBrrcH|jtjdddy)Nr rB)rrDrrs rtest_sha256_rfc4231z'TestVectorsTestCase.test_sha256_rfc4231JrrrcH|jtjdddy)Nr0)rrDrrs rtest_sha384_rfc4231z'TestVectorsTestCase.test_sha384_rfc4231N  2sCrrcH|jtjdddy)NrrBr)rrDrrs rtest_sha512_rfc4231z'TestVectorsTestCase.test_sha512_rfc4231RrrcGddt}tj5tjdt|jt5t
jdd||jddddd|_	|jt5t
jdd||jd	ddddddy#1swY`xYw#1swYxYw#1swYyxYw)
Nc eZdZ	dZdZdZy)JTestVectorsTestCase.test_legacy_block_size_warnings.<locals>.MockCrazyHashchtj||_|jj|_yr)rDr_xr$)r&rs  r__init__zSTestVectorsTestCase.test_legacy_block_size_warnings.<locals>.MockCrazyHash.__init__Zs$!..$/#'77#6#6 rc:|jj|yr)rr0)r&vs  rr0zQTestVectorsTestCase.test_legacy_block_size_warnings.<locals>.MockCrazyHash.update]sq!rc6|jjSr)rr rs rr zQTestVectorsTestCase.test_legacy_block_size_warnings.<locals>.MockCrazyHash.digest_sww~~''rN)__name__
__module____qualname__rr0r rrr
MockCrazyHashrXs5
7
"
(rrerrorabr+z)Expected warning about missing block_sizerOz'Expected warning about small block_size)
objectr
rsimplefilterRuntimeWarningassertRaisesr.rfailr%)r&rs  rtest_legacy_block_size_warningsz3TestVectorsTestCase.test_legacy_block_size_warningsVs	(F	(
$
$
&		E!!'>:"">2
G		$
>		EF
G()M$"">2
E		$
>		CD
E		E		E
G
G

E
E		E		Es;0C5*C>$C5"*C)C5C&	"C5)C2	.C55C>c	|jtd5d}d}tj||dddd|jtd5tjddd|jtd5tjddddy#1swYvxYw#1swYMxYw#1swYyxYw)Nzrequired.*digestmodrGrHr+)msgr,)assertRaisesRegex	TypeErrorr.rr1)r&r8r9s   rtest_with_digestmod_no_defaultz2TestVectorsTestCase.test_with_digestmod_no_defaultmsC

#
#I/E
F	1CDIIc440	1
#
#I/E
F	 HHS$	 

#
#I/E
F	3IIctr2	3	3
	1	1	 	 	3	3s#B*B6C*B36B?Ccttd}	tj|d<tjdddj}d}|j
|||jdy#|jdwxYw)N__builtin_constructor_cachefookeysmessage@6e9ef29b75fffc5b7abae527d58fdadb2fe42e7219011976917343065f58ed4a)r5rDrr.r hexrpop)r&cacherexpecteds    rtest_with_fallbackz&TestVectorsTestCase.test_with_fallbackxsj!>?	">>E%LFJ>BBDIYHY1IIeEIIesAA00BN)rrrr)r<rrequires_hashdigestr]rlrrrrrrrrrrrrr(s"3HT(^''t<'4='4R(^''=%<>%<Nun(^''$?C@C(^''$?C@C(^''$?D@D(^''$?D@D(^''1E2E,	3rrceZdZdZej
ddZej
ddZej
ddZej
ddZ	ej
ddZ
ej
ddZej
dd	Ze
jed
uddZe
jed
ud
dZy
)ConstructorTestCase@6c845b47f52b3b47f6590c502db7825aad757bf4fadc8fa972f7cd2e76a5bdebrct	tjddy#t$r|jdYywxYw)Nrrr+z+Standard constructor call raised exception.)r.r	Exceptionrrs rtest_normalzConstructorTestCase.test_normals4	EIIf1	EIICD	Es77c|jt5tjdd}dddy#1swYyxYwNr8rr+)rrr.rr&r's  rtest_with_str_keyz%ConstructorTestCase.test_with_str_keys7

y
)	5		%84A	5	5	5	7Ac|jt5tjdd}dddy#1swYyxYwr)rrr.r1rs  rtest_dot_new_with_str_keyz-ConstructorTestCase.test_dot_new_with_str_keys7

y
)	4(3A	4	4	4rc	tjddd}|j	j|jy#t$r|jdYGwxYw)Nr
hash this!rr+z5Constructor call with text argument raised exception.)r.rrrrrrrs  r
test_withtextz!ConstructorTestCase.test_withtextsV	O		&-8DA	


6	OIIMN	OsAA"!A"c	tjtdtdd}|jj
|jy#t$r|j	dYGwxYw)Nrrrr+z;Constructor call with bytearray arguments raised exception.)r.r	bytearrayrrrrrrs  rtest_with_bytearrayz'ConstructorTestCase.test_with_bytearraysc	U		)F+Y}-E$,.A	


6	UIIST	Us*AA43A4c	tjdtdd}|jj
|jy#t$r|j	dYGwxYw)Nrrrr+z6Constructor call with memoryview msg raised exception.)r.r
memoryviewrrrrrrs  rtest_with_memoryview_msgz,ConstructorTestCase.test_with_memoryview_msgs[	P		&*]";xPA	


6	PIINO	Ps!AA+*A+c	tjddtj}y#t$r|jdYywxYw)Nrrz6Constructor call with hashlib.sha256 raised exception.)r.rrDrrrrs  rtest_withmodulez#ConstructorTestCase.test_withmodules<	P		&#w~~6A	PIINO	Ps%(AANz
need _hashlibct|t|jtd5dt_dddy#1swYyxYw)Nzimmutable type)rC_HMACrrvaluers rtest_internal_typesz'ConstructorTestCase.test_internal_typess;	%T62

#
#I/?
@	 FL	 	 	 s	<Azneed _sha256ctjddtj}|j	|j|j|j	|jdtjddtj}|j	|tj|jy)Nrrr+zhmac-sha256)r.r
sha256_modulerrrrr#r r!r")r&r'r s   rtest_with_sha256_modulez+ConstructorTestCase.test_with_sha256_modulesIIfm}7K7KL

6/V]M4H4HI!3!3DMM!BCr)rrrrrrrrrrrrrunittest
skipUnlessrrrrrrrrrsK	K
(^''1E2E(^''1525(^''1424(^''1727(^''1727(^''1727(^''1P2PXt+_= > Xd2NCDDDrrc<eZdZejddZy)SanityTestCaserc	tjdd}|jd|j|j	|jy#t$r|jdYywxYw)Ns
my secret keyrr+scompute the hash of this text!z3Exception raised during normal usage of HMAC class.)r.rr0r rr/rrrs  rtest_exercise_all_methodsz(SanityTestCase.test_exercise_all_methodss_	M		*h?A
HH67
HHJ
KKM
FFH	MIIKL	MsAAA87A8N)rrrrrrrrrrrs#'^''1
M2
Mrrc,eZdZejddZejddZeje	dudejddZ
ejddZejddZy)	CopyTestCaserctjjtj}|jddd|j	}|jt
|jt
|jd|jt
|jt
|jdy)Nrmsgrr+zTypes of inner don't match.zTypes of outer don't match.)	r.rr2r3r/rtype_inner_outerr&h1r;s   rtest_attributes_oldz CopyTestCase.test_attributes_oldsYY

tyy
)
VVx8
WWYbii$ryy/)	+bii$ryy/)	+rctjjtj}|jddd|j	}|jt
|t
|k7d|jt
|jt
|jk7d|jt
|jt
|jk7d|j|jdy)Nrrrr+"No real copy of the HMAC instance.z&No real copy of the attribute 'inner'.z&No real copy of the attribute 'outer'.)r.rr2r3r/
assertTrueidrrassertIs_hmacrs   rtest_realcopy_oldzCopyTestCase.test_realcopy_oldsYY

tyy
)
VVx8
WWY2"R&(*NO299
BII64	6299
BII64	6

bhh%rNztest requires _hashopensslctjjtj}|jddd|j	}|jt
|jt
|jk7y)Nrrrr+)r.rr2r7r/rrrrs   rtest_realcopy_hmaczCopyTestCase.test_realcopy_hmacsZYY

tyy
)


ff
9
WWY28828845rc0tjdd}|jd|j}|j	|j|jd|j	|j
|j
dy)Nrrr+some random text-Digest of copy doesn't match original digest.3Hexdigest of copy doesn't match original hexdigest.)r.rr0r/rr rrs   r
test_equalityzCopyTestCase.test_equalitysoYYv
2
		%&
WWYbiik;	=A	Crc~tjdd}|jd|j}|j	t|t|k7d|j
|j|jd|j
|j|jdy)Nrrr+rrrr)	r.r1r0r/rrrr rrs   rtest_equality_newzCopyTestCase.test_equality_newsXXf
1
		%&
WWYrFbfB	
	
biik;	=A	Cr)
rrrrrrrrskipIfr6rrr	rrrrrs'^''1+2+(^''1&2&X__\T)+GH'^''162I6(^''1C2C(^''1C2CrrcTeZdZdZdZejeduddZdZ	y)CompareDigestTestCasec|jtjt%|j	tjty|j	tjt
yr)_test_compare_digestr.ropenssl_compare_digestroperator_compare_digestrs rtest_hmac_compare_digestz.CompareDigestTestCase.test_hmac_compare_digest!sF!!$"5"56!-MM$--/EFMM$--/FGrc.|jtyr)rrrs rtest_operator_compare_digestz2CompareDigestTestCase.test_operator_compare_digest(s!!"9:rNztest requires _hashlibc.|jtyr)rrrs rtest_openssl_compare_digestz1CompareDigestTestCase.test_openssl_compare_digest+s!!"89rcd\}}|jt|||d\}}|jt|||d\}}|jt|||d\}}|jt|||d\}}|jt|||d\}}|j|||d\}}|j|||d\}}|j|||d	\}}|j|||d
\}}|j|||d\}}|j|||t	dt	d}}|j|||t	dt	d
}}|j|||t	dt	d}}|j|||t	dd}}|j||||j|||t	dd
}}|j||||j|||t	dd}}|j||||j|||d\}}|j|||d\}}|j|||d\}}|j|||d\}}|jt|||d\}}|jt|||d\}}|jt|||d\}}|jt|||d\}}|jt|||Gddt
}|d|d}}|j||||dd}}|j||||d|d}}|j|||Gddt}|d|d}}|j||||dd}}|j||||d|d}}|j|||y)N)d)rfoobar)rr)foobarr)rr)rfoo)ޭsޭ)rfoobaz)rs)rr)rrrrr)rr)rr)rfoobaz)rrO)fooärceZdZdZy)9CompareDigestTestCase._test_compare_digest.<locals>.mystrcyNFrr&others  r__eq__z@CompareDigestTestCase._test_compare_digest.<locals>.mystr.__eq__rNrrrr&rrrmystrr!
rr)rrceZdZdZy);CompareDigestTestCase._test_compare_digest.<locals>.mybytescyr#rr$s  rr&zBCompareDigestTestCase._test_compare_digest.<locals>.mybytes.__eq__r'rNr(rrrmybytesr,r*rr.)rrassertFalserrstrr[)r&rabr)r.s      rrz*CompareDigestTestCase._test_compare_digest/sU1)^Q:1)^Q:1)^Q:"1)^Q:"1)^Q:!11-./11-.$11-.711-.$1q!,-71q!,-#Yy%91q!,-#Yv%611-.#Yy%911-.#Y1q!,-q!,-#V11-.1-.#Y11-.1-."1q!,-11-."11-.#1)^Q:"1)^Q:1)^Q:1)^Q:1)^Q:	C	Xh1q!,-X1q!,-Xh11-.	e	y!79#51q!,-y!91q!,-y!79#511-.r)
rrrrrrr
rrrrrrrrs<H;X__+t35MN:O:g/rr__main__)!r!rr.rDr
unittest.mockr
test.supportrr	_operatorrr_hashlibr6rrrr4rrImportError_sha256rrTestCaserrrrrrmainrrr<module>r<sE@	"#'/A#
X(++Xv
LD(++LD^
MX&&
M :C8$$:Czw/H--w/tzHMMOO"L
FJ!	"Ms#CC
CCC('C(