get_signature

function get_signature(data_hash: byte_array, privkey: byte_array): byte_array

Sign a 32-byte array with a 32-byte private key using the ECDSA (secp256k1) algorithm.

The given 32-byte array data_hash is typically a cryptographic hash obtained from a larger data structure using a hashing function such as hash(), sha256() or keccak256().

The returned value can be verified with verify_signature() using the public key belonging to the keypair of the given private key.

Return

a 64-byte signature

Since

0.13.11

Parameters

data_hash

a 32-byte array to be signed

privkey

the 32-byte private key with which to sign

Throws

exception

if either privkey or data_hash are not exactly 32 bytes long