%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/cred/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/cred/__pycache__/_digest.cpython-312.pyc

�

Ϫ�f���F�dZddlmZddlmZmZeeed�Z	d	d�Zd�Zd�Z	y)
z^
Calculations for HTTP Digest authentication.

@see: U{http://www.faqs.org/rfcs/rfc2617.html}
�)�hexlify)�md5�sha1)smd5�md5-sesssshaNc�,�|r|s|s|rtd��|�|t|�}|j|�|jd�|j|�|jd�|j|�t|j	��}n|}|dk(r{t|�}|j|�|jd�|j|�|jd�|j|�t|j	��}|S)a:
    Compute H(A1) from RFC 2617.

    @param pszAlg: The name of the algorithm to use to calculate the digest.
        Currently supported are md5, md5-sess, and sha.
    @param pszUserName: The username
    @param pszRealm: The realm
    @param pszPassword: The password
    @param pszNonce: The nonce
    @param pszCNonce: The cnonce

    @param preHA1: If available this is a str containing a previously
       calculated H(A1) as a hex string.  If this is given then the values for
       pszUserName, pszRealm, and pszPassword must be L{None} and are ignored.
    zPpreHA1 is incompatible with the pszUserName, pszRealm, and pszPassword arguments�:r)�	TypeError�
algorithms�updater�digest)	�pszAlg�pszUserName�pszRealm�pszPassword�pszNonce�	pszCNonce�preHA1�m�HA1s	         �6/usr/lib/python3/dist-packages/twisted/cred/_digest.py�calcHA1r!s���&�;�(�k��
2�
�	
�
�~��v�� ��	�����	�����	�����	�����	������a�h�h�j�!����
����v�� ��	����
�	�����	�����	�����	������a�h�h�j�!���J�c��t|�}|j|�|jd�|j|�|dk(r"|jd�|j|�t|j��S)a�
    Compute H(A2) from RFC 2617.

    @param algo: The name of the algorithm to use to calculate the digest.
        Currently supported are md5, md5-sess, and sha.
    @param pszMethod: The request method.
    @param pszDigestUri: The request URI.
    @param pszQop: The Quality-of-Protection value.
    @param pszHEntity: The hash of the entity body or L{None} if C{pszQop} is
        not C{'auth-int'}.
    @return: The hash of the A2 value for the calculation of the response
        digest.
    rsauth-int�r
rrr)�algo�	pszMethod�pszDigestUri�pszQop�
pszHEntityrs      r�calcHA2r Ssd��	�4���A��H�H�Y���H�H�T�N��H�H�\��
���	�����	������1�8�8�:��rc���t|�}|j|�|jd�|j|�|jd�|rh|rf|j|�|jd�|j|�|jd�|j|�|jd�|j|�t|j��}|S)a�
    Compute the digest for the given parameters.

    @param HA1: The H(A1) value, as computed by L{calcHA1}.
    @param HA2: The H(A2) value, as computed by L{calcHA2}.
    @param pszNonce: The challenge nonce.
    @param pszNonceCount: The (client) nonce count value for this response.
    @param pszCNonce: The client nonce.
    @param pszQop: The Quality-of-Protection value.
    rr)	r�HA2rr�
pszNonceCountrrr�respHashs	         r�calcResponser%ks���	�4���A��H�H�S�M��H�H�T�N��H�H�X���H�H�T�N���	�����	�����	�����	�����	�����	������H�H�S�M��q�x�x�z�"�H��Or)N)
�__doc__�binasciir�hashlibrrr
rr r%�rr�<module>r*s=��
���

����
�"MQ�/�d�0r

Zerion Mini Shell 1.0