Exemplo n.º 1
0
 def _sign(seq, to, value, data, key):
     keys = KeyAPI()
     comb = seq.to_bytes(32, "big") + b'\x00' * 12 + to + value.to_bytes(32, "big") + data
     h1 = keccak(comb)
     h2 = keccak(b"\x19Ethereum Signed Message:\n32" + h1)
     sig = keys.ecdsa_sign(h2, key)
     return [28 if sig.v == 1 else 27, sig.r, sig.s]
Exemplo n.º 2
0
def sign_hash(hash, priv):
    keys = KeyAPI(NativeECCBackend)
    sign = keys.ecdsa_sign(hash, priv)
    return sign.to_bytes()