dbfdg 3 kZ @sdZddlZddlZddlZejddkZer8eZeZ ne ZeZ ee fZ y ej Z Wnek rnddZ YnXeeddrddZnd dZdS) z The `compat` module provides support for backwards compatibility with older versions of python, and compatibility wrappers around optional packages. NcCsLt|t|krdSd}x*t||D]\}}|t|t|AO}q$W|dkS)z Returns True if the two strings are equal, False otherwise. The time taken is independent of the number of characters that match. Fr)lenzipord)Zval1Zval2resultxyr /usr/lib/python3.6/compat.pyconstant_time_compares r to_bytescCs6|}d}x|dkr$|d?}|d7}q W|j|dddS)NrZbigF)Zsigned)r )valZ remainingZ byte_lengthr r r bytes_from_int.s   rcCsFg}x |r$t|d\}}|j|qW|jtjdt|f|S)Nz%sB)divmodappendreversestructpackr)rZbufZ remainderr r r r8s )__doc__Zhmacrsys version_infoZPY3strZ text_typebytesZ binary_typeZunicodeZ string_typesZcompare_digestr AttributeErrorgetattrintrr r r r s"