+
    @i"                     \    R t ^ RIt^ RIHt ^RIHtHtHt ^RIH	t	 . ROt
R tR tR	R ltR# )
a  
RFC 6979:
    Deterministic Usage of the Digital Signature Algorithm (DSA) and
    Elliptic Curve Digital Signature Algorithm (ECDSA)

    http://tools.ietf.org/html/rfc6979

Many thanks to Coda Hale for his implementation in Go language:
    https://github.com/codahale/rfc6979
N)hexlify)number_to_stringnumber_to_string_crop
bit_length)hmac_compatc                 ~    \        \        V 4      ^4      p\        V 4      ^,          pW18  d   W#V,
          ,	          # V# )   )intr   len)dataqlenxls   &&  K/var/www/html/photoedit/myenv/lib/python3.14/site-packages/ecdsa/rfc6979.pybits2intr      s5    GDM2AD	AAxXH    c                 d    \        V \        V4      4      pW!,
          pV^ 8  d   Tp\        W14      # )    )r   r   r   )r   orderz1z2s   &&  r   bits2octetsr       s1    	$
5)	*B	B	Av ++r   c                b   \        V 4      pV! 4       P                  pV^,           ^,          p\        \        W4      4      \        \	        W04      4      \        V4      3p	RV,          p
RV,          p\
        P                  ! WR7      pVP                  V
R,           4       V	 F  pVP                  V4       K  	  VP                  4       p\
        P                  ! WV4      P                  4       p
\
        P                  ! WR7      pVP                  V
R,           4       V	 F  pVP                  V4       K  	  VP                  4       p\
        P                  ! WV4      P                  4       p
 Rp\        V4      V8  d0   \
        P                  ! WV4      P                  4       p
W,          pK?  \        W4      p^Tu;8:  d   V 8  d   M MV^ 8:  d   V# V^,          p\
        P                  ! WR,           V4      P                  4       p\
        P                  ! WV4      P                  4       p
K  )a  
Generate the ``k`` value - the nonce for DSA.

:param int order: order of the DSA generator used in the signature
:param int secexp: secure exponent (private key) in numeric form
:param hash_func: reference to the same hash function used for generating
    hash, like :py:class:`hashlib.sha1`
:param bytes data: hash in binary form of the signing data
:param int retry_gen: how many good 'k' values to skip before returning
:param bytes extra_entropy: additional added data in binary form as per
    section-3.6 of rfc6979
:rtype: int
       )	digestmodr   )r   digest_sizer   r   r   hmacnewupdatedigestr
   r   )r   secexp	hash_funcr   	retry_genextra_entropyr   holenrolenbxvkitsecrets   &&&&&&         r   
generate_kr-   +   s    eDK##EAX!OE$V34K,-M"
B 	%A 	%A 	(AHHQ[	 	
A 	y!((*A 	(AHHQ[	 	
A 	y!((*A  !funy)002AFA !"A~NIHHQGY/668HHQ9%,,.r   )r   r   r   r-   )r   r   )__doc__r   binasciir   utilr   r   r   _compatr   __all__r   r   r-    r   r   <module>r4      s3   	   E E  
 B,F/r   