ecdsa.rfc6979 module

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

ecdsa.rfc6979.bit_length(x)[source]
ecdsa.rfc6979.bits2int(data, qlen)[source]
ecdsa.rfc6979.bits2octets(data, order)[source]
ecdsa.rfc6979.generate_k(order, secexp, hash_func, data, retry_gen=0, extra_entropy=b'')[source]

Generate the k value - the nonce for DSA.

Parameters:
  • order (int) – order of the DSA generator used in the signature

  • secexp (int) – secure exponent (private key) in numeric form

  • hash_func – reference to the same hash function used for generating hash, like hashlib.sha1

  • data (bytes) – hash in binary form of the signing data

  • retry_gen (int) – how many good ‘k’ values to skip before returning

  • extra_entropy (bytes) – additional added data in binary form as per section-3.6 of rfc6979

Return type:

int