sign_with_nonce

Function sign_with_nonce 

Source
fn sign_with_nonce(
    private_key: &U256,
    digest: &B256,
    nonce: &U256,
) -> Result<Signature>
Expand description

Signs digest on secp256k1 using a user-supplied ephemeral nonce k (no RFC6979).

  • private_key and nonce must be in (0, n)
  • digest is a 32-byte prehash.

ยงWarning

Use sign_with_nonce with extreme caution! Reusing the same nonce (k) with the same private key in ECDSA will leak the private key. Always generate nonce with a cryptographically secure RNG, and never reuse it across signatures.