관리-도구
편집 파일: test_HMAC.cpython-311.pyc
� O�Dg�M � � � d Z ddlZddlmZ ddlmZmZ ddlmZm Z m Z mZmZm Z mZmZmZmZmZmZ ee e eee eeeeee�� � ZdZd� Zg dd ed �� � df�dd ed � � � df�dd ed�� � df�dd edd�� � df�dd ed� � � df�dd ed�� � df�d d! ed"d#�� � d$f�d%d& ed'� � � d(f�d)d& ed*�� � d+f�d,d- ed.d/�� � d0f�d,d1 ed2d3�� � d4f�dd ed5�6� � d7f�dd ed8�6� � d9f�dd ed:�6� � d;f�d d! ed<�6� � d=f�d>d- ed?�6� � d@f�d>dA edB�6� � dCf�dd edD�E� � dFf�dd edG�H� � dIf�dd edJ�K� � dLf�d edM� � edN�O� � dPf� edQ� � edR� � edS�O� � dTf�dd edU�O� � dVf�d d! edW�O� � dXf�d) edY� � edZ�O� � d[f�d, ed\� � ed]�O� � d^f�d, ed_� � ed`�O� � daf�db edc� � edd�e� � dff�dg edh� � edi�e� � djf�dk edl� � edm�e� � dnf�do edc� � edp�q� � drf�ds edh� � edt�q� � duf�dv edl� � edw�q� � dxf�dy edc� � edz�{� � d|f�d} edh� � ed~�{� � df�d� edl� � ed��{� � d�f�d� edc� � ed���� � d�f�d� edh� � ed���� � d�f�ds edl� � ed���� � d�f�a G d�� d�ej � � Z G d�� d�ej � � Z G d�� d�ej � � Z G d�� d�ej � � Zi fd��Zed�k rd�� Z ej! d���� � dS dS )�z$Self-test suite for Crypto.Hash.HMAC� N)�hexlify)�tostr�tobytes)�HMAC�MD5�SHA1�SHA256�SHA224�SHA384�SHA512� RIPEMD160�SHA3_224�SHA3_256�SHA3_384�SHA3_512)r r r r r r r r r r r c �T � t t t | � � � � � � S �N)r r r )�texts ��/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/SelfTest/Hash/test_HMAC.py�xlr - s � �������'�'�(�(�(� � 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b�4869205468657265� 9294727a3638bb1c13f48ef8158bfc9d)�default_hashzdefault-is-MD5)r zRFC 2202 #1-MD5 (HMAC-MD5)�(0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b�(b617318655057264e28bc0b6fb378c8ef146be00)r zRFC 2202 #1-SHA1 (HMAC-SHA1)�4a656665�87768617420646f2079612077616e7420666f72206e6f7468696e673f� 750c783e6ab0b503eaa86e310a5db738�(effcdf6ae5eb2fa2d27416d5f184df9c259a7c79)r r zRFC 2202 #2 (HMAC-MD5/SHA1)� aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa�ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd� 56be34521d144c88dbb8c733f0e8b3f6zRFC 2202 #3-MD5 (HMAC-MD5)�(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa�(125d7342b9ac11cd91a39af48aa17b4f63f175d3zRFC 2202 #3-SHA1 (HMAC-SHA1)�20102030405060708090a0b0c0d0e0f10111213141516171819�dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd� 697eaf0aca3a3aea3a75164746ffaa79�(4c9007f4026250c6bc8414f9bf50c86c2d7235dazRFC 2202 #4 (HMAC-MD5/SHA1)� 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c�(546573742057697468205472756e636174696f6e� 56461ef2342edc00f9bab995690efd4czRFC 2202 #5-MD5 (HMAC-MD5)�(0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c�(4c1a03424b55e07fe7f27be1d58bb9324a9a5a04zRFC 2202 #5-SHA1 (HMAC-SHA1)ڠaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa�l54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b6579202d2048617368204b6579204669727374� 6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd�(aa4ae5e15272d00e95705637ce8a3b55ed402112zRFC 2202 #6 (HMAC-MD5/SHA1)ڒ54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b657920616e64204c6172676572205468616e204f6e6520426c6f636b2d53697a652044617461� 6f630fad67cda0ee1fb1f562db3aa53e�(e8e99d0f45237d786d6bbaa7965c7808bbff1a91zRFC 2202 #7 (HMAC-MD5/SHA1)zc b0344c61d8db38535ca8afceaf0bf12b 881dc200c9833da726e9376c2e32cff7 )r zRFC 4231 #1 (HMAC-SHA256)zc 5bdcc146bf60754e6a042426089575c7 5a003f089d2739839dec58b964ec3843 zRFC 4231 #2 (HMAC-SHA256)zc 773ea91e36800e46854db8ebd09181a7 2959098b3ef8c122d9635514ced565fe zRFC 4231 #3 (HMAC-SHA256)zc 82558a389a443c0ea4cc819899f2083a 85f0faa3e578f8077a2e3ff46729665b zRFC 4231 #4 (HMAC-SHA256)� aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazc 60e431591ee0b67f0d8a26aacbf5b77f 8e0bc6213728c5140546040f0ee37f54 zRFC 4231 #6 (HMAC-SHA256)�0 5468697320697320612074657374207573696e672061206c6172676572207468616e20626c6f636b2d73697a65206b657920616e642061206c6172676572207468616e20626c6f636b2d73697a6520646174612e20546865206b6579206e6565647320746f20626520686173686564206265666f7265206265696e6720757365642062792074686520484d414320616c676f726974686d2ezc 9b09ffa71b942fcb27635fbcd5b0e944 bfdc63644f0713938a7f51535c3a35e2 zRFC 4231 #7 (HMAC-SHA256)�8a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44)r z!RFC 4634 8.4 SHA224 (HMAC-SHA224)�`af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649)r z!RFC 4634 8.4 SHA384 (HMAC-SHA384)ڀ164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737)r z!RFC 4634 8.4 SHA512 (HMAC-SHA512)zHi There�(24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668)r zRFC 2286 #1 (HMAC-RIPEMD)�Jefezwhat do ya want for nothing?�(dda6c0213a485a9e24f4742064a7f033b43c4069zRFC 2286 #2 (HMAC-RIPEMD)�(b0b105360de759960ab4f35298e116e295d8e7c1zRFC 2286 #3 (HMAC-RIPEMD)�(d5ca862f4d21d5e610e18b4cf1beb97a4365ecf4zRFC 2286 #4 (HMAC-RIPEMD)zTest With Truncation�(7619693978f91d90539ae786500ff3d8e0518e39zRFC 2286 #5 (HMAC-RIPEMD)z6Test Using Larger Than Block-Size Key - Hash Key First�(6466ca07ac5eac29e1bd523e5ada7605b791fd8bzRFC 2286 #6 (HMAC-RIPEMD)zITest Using Larger Than Block-Size Key and Larger Than One Block-Size Data�(69ea60798d71616cce5fd0871e23754cd75d5a0azRFC 2286 #7 (HMAC-RIPEMD)�8000102030405060708090a0b0c0d0e0f101112131415161718191a1bz"Sample message for keylen<blocklen�8332cfd59347fdb8e576e77260be4aba2d6dc53117b3bfb52c6d18c04)r zNIST CSRC Sample #1 (SHA3-224)� 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8fz"Sample message for keylen=blocklen�8d8b733bcf66c644a12323d564e24dcf3fc75f231f3b67968359100c7zNIST CSRC Sample #2 (SHA3-224)�X 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabz"Sample message for keylen>blocklen�8078695eecc227c636ad31d063a15dd05a7e819a66ec6d8de1e193e59zNIST CSRC Sample #3 (SHA3-224)�@000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f�@4fe8e202c4f058e8dddc23d8c34e467343e23555e24fc2f025d598f558f67205)r zNIST CSRC Sample #1 (SHA3-256)� 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f8081828384858687�@68b94e2e538a9be4103bebb5aa016d47961d4d1aa906061313b557f8af2c3faazNIST CSRC Sample #2 (SHA3-256)�P 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7�@9bcf2c238e235c3ce88404e813bd2f3a97185ac6f238c63d6229a00b07974258zNIST CSRC Sample #3 (SHA3-256)�`000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f�`d588a3c51f3f2d906e8298c1199aa8ff6296218127f6b38a90b6afe2c5617725bc99987f79b22a557b6520db710b7f42)r zNIST CSRC Sample #1 (SHA3-384)��000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f6061626364656667�`a27d24b592e8c8cbf6d4ce6fc5bf62d8fc98bf2d486640d9eb8099e24047837f5f3bffbe92dcce90b4ed5b1e7e44fa90zNIST CSRC Sample #2 (SHA3-384)�0 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f9091929394959697�`e5ae4c739f455279368ebf36d4f5354c95aa184c899d3870e460ebc288ef1f9470053f73f7c6da2a71bcaec38ce7d6aczNIST CSRC Sample #3 (SHA3-384)ڀ000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3fڀ4efd629d6c71bf86162658f29943b1c308ce27cdfa6db0d9c3ce81763f9cbce5f7ebe9868031db1a8f8eb7b6b95e5c5e3f657a8996c86a2f6527e307f0213196)r zNIST CSRC Sample #1 (SHA3-512)ڐ000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f4041424344454647ڀ544e257ea2a3e5ea19a590e6a24b724ce6327757723fe2751b75bf007d80f6b360744bf1b7a88ea585f9765b47911976d3191cf83c039f5ffab0d29cc9d9b6dazNIST CSRC Sample #2 (SHA3-512)ڀ5f464f5e5b7848e3885e49b2c385f0694985d0e38966242dc4a5fe3fea4b37d46b65ceced5dcf59438dd840bab22269f0ba7febdb9fcf74602a35666b2a32915zNIST CSRC Sample #3 (SHA3-512)c �$ � e Zd ZdZd� Zd� Zd� ZdS )�HMAC_Module_and_Instance_Testz�Test the HMAC construction and verify that it does not matter if you initialize it with a hash module or with an hash instance. See https://bugs.launchpad.net/pycrypto/+bug/1209399 c �` � t j � | � � || _ d| _ dS )zTInitialize the test with a dictionary of hash modules indexed by their names� N)�unittest�TestCase�__init__�hashmods�description)�selfrb s r ra z&HMAC_Module_and_Instance_Test.__init__� s0 � � ��"�"�4�(�(�(� �� �����r c � � | j S r )rc )rd s r �shortDescriptionz.HMAC_Module_and_Instance_Test.shortDescription� s � ���r c �V � d}d}| j � � � D ]�\ }}|��d|z | _ t j |||� � � � � }t j |||� � � � � � � � }| � ||� � ��d S )Ns ����������������sd zTest HMAC in combination with )rb �itemsrc r �new�digest�assertEqual)rd �key�payload�hashname�hashmod�one�twos r �runTestz%HMAC_Module_and_Instance_Test.runTest� s� � �%����!%��!4�!4�!6�!6� '� '��H�g����?�(�J�D���(�3���1�1�8�8�:�:�C��(�3�������7�7�>�>�@�@�C����S�#�&�&�&�&� '� 'r N)�__name__� __module__�__qualname__�__doc__ra rf rr � r r r\ r\ � sK � � � � � �� �� � � � � � '� '� '� '� 'r r\ c � � e Zd Zd� ZdS )� HMAC_Nonec �� � d}t j |dt � � � � � }t j |d t � � � � � }| � ||� � d S )Ns r )r ri r rj rk )rd rl rp rq s r rr zHMAC_None.runTest� sa � ����h�s�C��&�&�-�-�/�/���h�s�D�$�'�'�.�.�0�0������c�"�"�"�"�"r N�rs rt ru rr rw r r ry ry � s# � � � � � �#� #� #� #� #r ry c � � e Zd Zd� ZdS )�ByteArrayTestsc � � d}d}t |� � }t |� � }t j ||� � }t j ||� � }d|d d�<