%PDF- %PDF-
| Direktori : /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ |
| Current File : //opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/rfc6979.pyc |
�
�ac @ s� d Z d d l Z d d l m Z d d l m Z m Z m Z d d l m Z d d d d
g Z
d � Z d � Z d
d d � Z
d S( s
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
i����N( t hexlifyi ( t number_to_stringt number_to_string_cropt
bit_length( t hmac_compatR t bits2intt bits2octetst
generate_kc C sA t t | � d � } t | � d } | | k r= | | | ?S| S( Ni i ( t intR t len( t datat qlent xt l( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/rfc6979.pyR s
c C sA t | t | � � } | | } | d k r4 | } n t | | � S( Ni ( R R R ( R
t ordert z1t z2( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/rfc6979.pyR s
i t c C s t | � } | � j } | d d } t t | | � � t t | | � � t | � f } d | }
d | } t j | d | �} | j |
d � x | D] } | j | � q� W| j � } t j | |
| � j � }
t j | d | �} | j |
d � x | D] } | j | � qW| j � } t j | |
| � j � }
x� t rd }
x; t
|
� | k r�t j | |
| � j � }
|
|
7}
qUWt |
| � } d | k o�| k n r�| d k r�| S| d 8} n t j | |
d | � j � } t j | |
| � j � }
qFWd S(
s�
order - order of the DSA generator used in the signature
secexp - secure exponent (private key) in numeric form
hash_func - reference to the same hash function used for generating hash
data - hash in binary form of the signing data
retry_gen - int - how many good 'k' values to skip before returning
extra_entropy - extra added data in binary form as per section-3.6 of
rfc6979
i i s s t digestmodR i i N( R t digest_sizeR R R t hmact newt updatet digestt TrueR R ( R t secexpt hash_funcR
t retry_gent
extra_entropyR t holent rolent bxt vt kt it tt secret( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/rfc6979.pyR + s@
( t __doc__R t binasciiR t utilR R R t _compatR t __all__R R R ( ( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/rfc6979.pyt <module>
s