403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.217.130
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_hmac.cpython-36.pyc
3

�w2_P�@s�ddlZddlZddlZddlZddlZdd�ZGdd�dej�ZGdd�dej�ZGdd	�d	ej�Z	Gd
d�dej�Z
Gdd
�d
ej�Zedkr�ej
�dS)�Ncstj���fdd��}|S)Ncs,tj��tjdtd��||�SQRXdS)N�ignore)�category)�warnings�catch_warnings�filterwarnings�PendingDeprecationWarning)�args�kwargs)�func��3/opt/alt/python36/lib64/python3.6/test/test_hmac.py�wrapper	s
zignore_warning.<locals>.wrapper)�	functools�wraps)r
r
r)r
r�ignore_warningsrc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�TestVectorsTestCasecs~�fdd�}|ddd�|ddd	�|dddd
�|ttdd��ddd�|ddd�|d
ddd�|d
ddd�dS)Ncs�tj||tjd�}�j|j�j�|j���j|jd��j|jd��j|j	d�tj||dd�}�j|j�j�|j���j|jd��j|jd��j|j	d�dS)N)�	digestmodzhmac-md5��@�md5)
�hmac�HMAC�hashlibr�assertEqual�	hexdigest�upper�name�digest_size�
block_size)�key�data�digest�h)�selfrr�md5testsz5TestVectorsTestCase.test_md5_vectors.<locals>.md5test�rsHi There� 9294727A3638BB1C13F48EF8158BFC9DsJefeswhat do ya want for nothing?Z 750c783e6ab0b503eaa86e310a5db738�����2Z 56be34521d144c88dbb8c733f0e8b3f6����Z 697eaf0aca3a3aea3a75164746ffaa79�sTest With TruncationZ 56461ef2342edc00f9bab995690efd4c�Ps6Test Using Larger Than Block-Size Key - Hash Key FirstZ 6b1ab7fe4bd7bf8f0b62e6ce61b9d0cdsITest Using Larger Than Block-Size Key and Larger Than One Block-Size DataZ 6f630fad67cda0ee1fb1f562db3aa53ess����������������s)�bytes�range)r#r$r)r#r�test_md5_vectorss,z$TestVectorsTestCase.test_md5_vectorscs~�fdd�}|ddd�|ddd	�|dddd
�|ttdd��ddd�|ddd�|d
ddd�|d
ddd�dS)Ncs�tj||tjd�}�j|j�j�|j���j|jd��j|jd��j|j	d�tj||dd�}�j|j�j�|j���j|jd��j|jd��j|j	d�dS)N)rz	hmac-sha1�r�sha1)
rrrr3rrrrrr)rr r!r")r#rr�shatestCsz5TestVectorsTestCase.test_sha_vectors.<locals>.shatestr%r2sHi ThereZ(b617318655057264e28bc0b6fb378c8ef146be00sJefeswhat do ya want for nothing?Z(effcdf6ae5eb2fa2d27416d5f184df9c259a7c79r'r(r)Z(125d7342b9ac11cd91a39af48aa17b4f63f175d3r*r+r,Z(4c9007f4026250c6bc8414f9bf50c86c2d7235dar-sTest With TruncationZ(4c1a03424b55e07fe7f27be1d58bb9324a9a5a04r.s6Test Using Larger Than Block-Size Key - Hash Key FirstZ(aa4ae5e15272d00e95705637ce8a3b55ed402112sITest Using Larger Than Block-Size Key and Larger Than One Block-Size DataZ(e8e99d0f45237d786d6bbaa7965c7808bbff1a91ss��������������������s)r/r0)r#r4r)r#r�test_sha_vectorsBs,z$TestVectorsTestCase.test_sha_vectorscs �����fdd�}|d,dtjdtjdtjdtjd	id
�|ddtjd
tjdtjdtjdid
�|d-ddtjdtjdtjdtjdid
�|tdd�tdd.�D��ddtjdtjdtjdtjd id
�|dd!d"tjd#tjd$tjd%tjd&id
�|dd!d'tjd(tjd)tjd*tjd+id
�dS)/Ncs�d�}tj||�d�}�j|j�j�|���j|j|��j|j���j|j��tj||�d�}�j|j�j�|���j|j|��j|j���j|j��dS)Nzhmac-)r)rrrr�lowerrrr)rr �
hexdigestsZ	hmac_namer")rr�	hash_name�hashfuncr#rr�hmactestosz9TestVectorsTestCase._rfc4231_test_cases.<locals>.hmactestr%r2sHi ThereZ8896fb1128abbdf196832107cd49df33f47b4b1169912ba4f53684b22Z@b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7Z`afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6Z�87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854)rr r7sJefeswhat do ya want for nothing?Z8a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44Z@5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843Z`af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649Z�164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737r'r(r)Z87fb3cb3588c6c1f6ffa9694d7d6ad2649365b0c1f65d69d1ec8333eaZ@773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565feZ`88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e55966144b2a5ab39dc13814b94e3ab6e101a34f27Z�fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fbcss|]
}|VqdS)Nr)�.0�xrrr�	<genexpr>�sz:TestVectorsTestCase._rfc4231_test_cases.<locals>.<genexpr>r*�r,Z86c11506874013cac6a2abc1bb382627cec6a90d86efc012de7afec5aZ@82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665bZ`3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffbZ�b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd�s6Test Using Larger Than Block-Size Key - Hash Key FirstZ895e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870eZ@60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54Z`4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952Z�80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598s�This 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.Z83a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1Z@9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2Z`6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523eZ�e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58ss��������������������r+)r�sha224�sha256�sha384�sha512r/r0)r#r9r8rrr:r)rrr8r9r#r�_rfc4231_test_casesnsJz'TestVectorsTestCase._rfc4231_test_casescCs|jtjddd�dS)Nr@�r)rDrr@)r#rrr�test_sha224_rfc4231�sz'TestVectorsTestCase.test_sha224_rfc4231cCs|jtjddd�dS)NrA� r)rDrrA)r#rrr�test_sha256_rfc4231�sz'TestVectorsTestCase.test_sha256_rfc4231cCs|jtjddd�dS)NrB�0�)rDrrB)r#rrr�test_sha384_rfc4231�sz'TestVectorsTestCase.test_sha384_rfc4231cCs|jtjddd�dS)NrCrrJ)rDrrC)r#rrr�test_sha512_rfc4231�sz'TestVectorsTestCase.test_sha512_rfc4231cCs�Gdd�dt�}tj��xtjdt�|jt�� tjdd|d�|jd�WdQRXd|_	|jt�� tjdd|d�|jd	�WdQRXWdQRXdS)
Nc@s(eZdZdZdd�Zdd�Zdd�ZdS)	zJTestVectorsTestCase.test_legacy_block_size_warnings.<locals>.MockCrazyHashz#Ain't no block_size attribute here.cWstj|�|_|jj|_dS)N)rr3�_xr)r#rrrr�__init__�szSTestVectorsTestCase.test_legacy_block_size_warnings.<locals>.MockCrazyHash.__init__cSs|jj|�dS)N)rM�update)r#�vrrrrO�szQTestVectorsTestCase.test_legacy_block_size_warnings.<locals>.MockCrazyHash.updatecSs
|jj�S)N)rMr!)r#rrrr!�szQTestVectorsTestCase.test_legacy_block_size_warnings.<locals>.MockCrazyHash.digestN)�__name__�
__module__�__qualname__�__doc__rNrOr!rrrr�
MockCrazyHash�srU�error�a�b)rz)Expected warning about missing block_sizer*z'Expected warning about small block_size)
�objectrr�simplefilter�RuntimeWarning�assertRaisesrr�failr)r#rUrrr�test_legacy_block_size_warnings�s

z3TestVectorsTestCase.test_legacy_block_size_warningsc
CsF|jt��2d}d}d}tj||�}|j|j�j�|�WdQRXdS)Nr%rsHi Therer&s)ZassertWarnsrrrrrr)r#rr r!r"rrr�test_with_digestmod_warningsz/TestVectorsTestCase.test_with_digestmod_warningN)rQrRrSr1r5rDrFrHrKrLr^r_rrrrrs.,{rc@sTeZdZedd��Zedd��Zedd��Zedd��Zd	d
�Zdd�Z	d
d�Z
dS)�ConstructorTestCasecCs6d}ytjd�}Wntk
r0|jd�YnXdS)Nrskeyz+Standard constructor call raised exception.)rr�	Exceptionr])r#Zfailedr"rrr�test_normals
zConstructorTestCase.test_normalc	Cs$|jt��tjd�}WdQRXdS)Nr)r\�	TypeErrorrr)r#r"rrr�test_with_str_keysz%ConstructorTestCase.test_with_str_keyc	Cs$|jt��tjd�}WdQRXdS)Nr)r\rcr�new)r#r"rrr�test_dot_new_with_str_key&sz-ConstructorTestCase.test_dot_new_with_str_keycCsDytjdd�}Wntk
r.|jd�YnX|j|j�d�dS)Nskeys
hash this!z5Constructor call with text argument raised exception.� 34325b639da4cfd95735b381e28cb864)rrrar]rr)r#r"rrr�
test_withtext-s
z!ConstructorTestCase.test_withtextcCsPytjtd�td�dd�}Wntk
r:|jd�YnX|j|j�d�dS)Nskeys
hash this!r)rz;Constructor call with bytearray arguments raised exception.rg)rr�	bytearrayrar]rr)r#r"rrr�test_with_bytearray6sz'ConstructorTestCase.test_with_bytearraycCsLytjdtd�dd�}Wntk
r6|jd�YnX|j|j�d�dS)Nskeys
hash this!r)rz6Constructor call with memoryview msg raised exception.rg)rr�
memoryviewrar]rr)r#r"rrr�test_with_memoryview_msg>s
z,ConstructorTestCase.test_with_memoryview_msgcCs8ytjddtj�}Wntk
r2|jd�YnXdS)Nskey�z4Constructor call with hashlib.sha1 raised exception.)rrrr3rar])r#r"rrr�test_withmoduleEsz#ConstructorTestCase.test_withmoduleN)rQrRrSrrbrdrfrhrjrlrnrrrrr`s		r`c@s eZdZedd��Zdd�ZdS)�SanityTestCasecCstjd�}|j|jtj�dS)Nskey)rrr�digest_consrr)r#r"rrr�test_default_is_md5Ns
z"SanityTestCase.test_default_is_md5cCsXy4tjddd�}|jd�|j�}|j�}|j�}Wntk
rR|jd�YnXdS)Ns
my secret keyr)rscompute the hash of this text!z3Exception raised during normal usage of HMAC class.)rrrOr!r�copyrar])r#r"�dig�h2rrr�test_exercise_all_methodsUs
z(SanityTestCase.test_exercise_all_methodsN)rQrRrSrrqrurrrrroLsroc@s$eZdZdd�Zdd�Zdd�ZdS)�CopyTestCasecCsbtjddd�}|j�}|j|j|jkd�|jt|j�t|j�d�|jt|j�t|j�d�dS)Nskeyr)rz digest constructors don't match.zTypes of inner don't match.zTypes of outer don't match.)	rrrr�
assertTruerpr�type�inner�outer)r#�h1rtrrr�test_attributescszCopyTestCase.test_attributescCsjtjddd�}|j�}|jt|�t|�kd�|jt|j�t|j�kd�|jt|j�t|j�kd�dS)Nskeyr)rz"No real copy of the HMAC instance.z&No real copy of the attribute 'inner'.z&No real copy of the attribute 'outer'.)rrrrrw�idryrz)r#r{rtrrr�
test_realcopynszCopyTestCase.test_realcopycCsPtjddd�}|jd�|j�}|j|j�|j�d�|j|j�|j�d�dS)Nskeyr)rssome random textz-Digest of copy doesn't match original digest.z3Hexdigest of copy doesn't match original hexdigest.)rrrOrrrr!r)r#r{rtrrr�
test_equalityys
zCopyTestCase.test_equalityN)rQrRrSr|r~rrrrrrvasrvc@seZdZdd�ZdS)�CompareDigestTestCasecCs�d\}}|jttj||�d\}}|jttj||�d\}}|jttj||�d\}}|jttj||�d\}}|jttj||�d\}}|jtj||��d\}}|jtj||��d\}}|jtj||��d\}}|jtj||��d\}}|jtj||��d\}}|jtj||��td�td�}}|jtj||��td�td�}}|jtj||��td�td�}}|jtj||��td�d}}|jtj||��|jtj||��td�d}}|jtj||��|jtj||��td�d}}|jtj||��|jtj||��d\}}|jtj||��d\}}|jtj||��d\}}|jtj||��d \}}|jttj||�d!\}}|jttj||�d"\}}|jttj||�d#\}}|jttj||�d$\}}|jttj||�Gdd�dt�}|d�|d�}}|jtj||��|d�d}}|jtj||��|d�|d�}}|jtj||��Gdd�dt�}|d�|d�}}|jtj||��|d�d}}|jtj||��|d�|d�}}|jtj||��dS)%N�d���foobar�foobar�foo�ޭ���ޭ�foobaz�����foo�foobazr*�fooäc@seZdZdd�ZdS)z8CompareDigestTestCase.test_compare_digest.<locals>.mystrcSsdS)NFr)r#�otherrrr�__eq__�sz?CompareDigestTestCase.test_compare_digest.<locals>.mystr.__eq__N)rQrRrSr�rrrr�mystr�sr�c@seZdZdd�ZdS)z:CompareDigestTestCase.test_compare_digest.<locals>.mybytescSsdS)NFr)r#r�rrrr��szACompareDigestTestCase.test_compare_digest.<locals>.mybytes.__eq__N)rQrRrSr�rrrr�mybytes�sr�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r*)r�r�)r�r�)	r\rcrZcompare_digestZassertFalserwri�strr/)r#�a�br�r�rrr�test_compare_digest�s�z)CompareDigestTestCase.test_compare_digestN)rQrRrSr�rrrrr��sr��__main__)rrrZunittestrrZTestCaserr`rorvr�rQ�mainrrrr�<module>s
8"l

Youez - 2016 - github.com/yon3zu
LinuXploit