� ���jk��$�dZddlZ ddlZej Zeej�Zddl Zej�s*ed�ed�D��Zed�ed�D��ZdZGd�d�Zd d �Zd �Zy#e $r dZdZddl m ZY�dwxYw) zqHMAC (Keyed-Hashing for Message Authentication) module. Implements the HMAC algorithm as described by RFC 2104. �N)�_compare_digestc#�&K�|] }|dz ��� y�w)�\N���.0�xs �/usr/lib64/python3.12/hmac.py� r �����4��A�a�$�h�����c#�&K�|] }|dz ��� y�w)�6Nrrs r r r r r c�Z�eZdZdZdZdZdd�Zd�Zd�Ze d��Z d �Z d �Z d �Z d �Zd �Zy)�HMACz~RFC 2104 HMAC class. Also complies with RFC 4231. This supports the API for Cryptographic Hash Functions (PEP 247). �@)�_hmac�_inner�_outer� block_size� digest_sizeNc��t|ttf�s!tdt |�j z��|s td��t j�st r+t|ttf�r |j|||�y|j|||�y#t j$r+t j�r�|j|||�YywxYw)a?Create a new HMAC object. key: bytes or buffer, key for the keyed hash object. msg: bytes or buffer, Initial input for the hash or None. digestmod: A hash name suitable for hashlib.new(). *OR* A hashlib constructor returning a new hash object. *OR* A module supporting PEP 247. Required as of 3.8, despite its position after the optional msg argument. Passing it as a keyword argument is recommended, though not required for legacy API reasons. z,key: expected bytes or bytearray, but got %rz&Missing required argument 'digestmod'.N) � isinstance�bytes� bytearray� TypeError�type�__name__� _hashopenssl� get_fips_mode�str� _functype� _init_hmac�UnsupportedDigestmodError� _init_old��self�key�msg� digestmods r �__init__z HMAC.__init__'s����#��y�1�2��J�T�RU�Y�M_�M_�_�`� `���D�E� E� � %� %� '�L�Z� �TW�Yb�Sc�=d� 4�����S�)�4� �N�N�3��Y� /��  �9�9� 4��-�-�/�����s�C��3� 4�s�6B�;C�Cc��tj|||��|_|jj|_|jj|_y)N)r+)r �hmac_newrrrr's r r$zHMAC._init_hmacEs;��!�*�*�3��y�I�� ��:�:�1�1����*�*�/�/���c���tj�r|j||��St��r�}nt �t �rd �fd� }nd �fd� }d|_|�|_|�|_|jj|_ t|jd�rR|jj}|dkrktjd||jfztd�|j}n4tjd|jztd�|j}t!|�|kDr||�j#�}||_ |j%|d�}|jj'|j)t*��|jj'|j)t,��|�|j'|�yy) Nc�0��tj�|�S�N��_hashlib�new��dr+s �r �z HMAC._init_old..Qs���� � �Y��(Br/c�&���j|�Sr2�r5r6s �r r8z HMAC._init_old..Ss��� � � �a�(8r/r�z:block_size of %d seems too small; using our default of %d.�z.�s���H�L�L���$;r/c�&���j|�Sr2r:rgs �r r8zdigest..�s ���F�J�J�q�Mr/rrr=r>)r rr"r#� hmac_digestr%r?�getattrrErFrHrIrKrJ)r)r*rFrL�inner�outerrCs ` r rFrF�s�����J�v��Y�7G�$H� ��+�+�C��f�=� =����� � �F�C� �;� �1� � �M�E� �M�E���|�R�0�I� �3�x�)���#��%�%�'�� ��9�s�3�x�/�0� 0�C� �L�L����x�(�)� �L�L����x�(�)� �L�L��� �L�L����� � �<�<�>���)�5�5� � � �s�D<�<E�Er])ra�warningsrAr4r �compare_digestr�openssl_sha256r#� ImportError� _operatorr�hashlibr!r�rangerJrKrrr5rFrr/r �rts���� �2�#� "�0�0�N��\�0�0�1�I��!�|�!�!�#��4��s��4�4�H��4��s��4�4�H�� �O�O�b%�( ��q�<��L��I�;�<�s�A=�=B�B