
    \e                         d Z ddlZddlZd Z	 ej                  Z	  ej                  d      ZddZy# e$ r eZY "w xY w# e	$ r ddZY yw xY w)	z*
Secret utilities.

.. versionadded:: 3.5
    Nc                     t        |       } t        |      }t        |       t        |      k7  ryd}t        | |      D ]  \  }}|t        |      t        |      z  z  }! |dk(  S )an  Return True if both string or binary inputs are equal, otherwise False.

    This function should take a constant amount of time regardless of
    how many characters in the strings match. This function uses an
    approach designed to prevent timing analysis by avoiding
    content-based short circuiting behaviour, making it appropriate
    for cryptography.
    Fr   )strlenzipord)firstsecondresultxys        8/usr/lib/python3/dist-packages/oslo_utils/secretutils.py_constant_time_comparer      sh     JE[F
5zS[ FE6" "1#a&3q6/!"Q;    Fusedforsecurityc                 0    t        j                  | |      S )a   Return an md5 hashlib object using usedforsecurity parameter

        For python distributions that support the usedforsecurity keyword
        parameter, this passes the parameter through as expected.
        See https://bugs.python.org/issue9216
        r   hashlibmd5stringr   s     r   r   r   4   s     {{6?CCr   c                 ,    t        j                  |       S )zReturn an md5 hashlib object without usedforsecurity parameter

        For python distributions that do not yet support this keyword
        parameter, we drop the parameter
        r   r   s     r   r   r   =   s     {{6""r   )r   T)
__doc__r   hmacr   compare_digestconstant_time_compareAttributeErrorr   _	TypeError r   r   <module>r!      so     &3 //#E*AD  323  ###s   4 A >>	AA