MCPcopy Create free account
hub / github.com/ElementsProject/elements / rfc6979_nonce

Function rfc6979_nonce

test/functional/test_framework/key.py:330–338  ·  view source on GitHub ↗

Compute signing nonce using RFC6979.

(key)

Source from the content-addressed store, hash-verified

328 return random.randrange(1, SECP256K1_ORDER).to_bytes(32, 'big')
329
330def rfc6979_nonce(key):
331 """Compute signing nonce using RFC6979."""
332 v = bytes([1] * 32)
333 k = bytes([0] * 32)
334 k = hmac.new(k, v + b"\x00" + key, 'sha256').digest()
335 v = hmac.new(k, v, 'sha256').digest()
336 k = hmac.new(k, v + b"\x01" + key, 'sha256').digest()
337 v = hmac.new(k, v, 'sha256').digest()
338 return hmac.new(k, v, 'sha256').digest()
339
340class ECKey():
341 """A secp256k1 private key"""

Callers 1

sign_ecdsaMethod · 0.85

Calls 1

digestMethod · 0.80

Tested by

no test coverage detected