# eth_sign · Rell standard library · Chromia Docs (concept)

> pure function eth_ sign(data_ hash: byte_array , privkey: byte_array ): ( byte_array , byte_array , integer ) Compute an Ethereum signature. The given 32-b

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/crypto/eth_sign/

FUNCTION

# eth\_sign

```signature
pure function eth_sign(data_hash: byte_array, privkey: byte_array): (byte_array, byte_array, integer)
```

Compute an Ethereum signature.

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 public key corresponding to the given private key can be computed from the original value of
`data_hash` and the returned signature tuple `(r, s, rec_id)` using the `eth_ecrecover()` method:

Rell

```
val (r, s, rec_id) = eth_sign(data_hash, privkey);
val pubkey = eth_ecrecover(r, s, rec_id, data_hash);
```

The returned signature component `rec_id` is an *adjusted* recovery identifier, equivalent to
Ethereum's recovery identifier (usually denoted as `v`) **minus 27**, i.e. `rec_id == v - 27`.

**Parameters**

* **data\_hash** — a 32-byte array to be signed
* **privkey** — the 32-byte private key with which to sign

**Returns**

a tuple containing the signature components:

* `r`, the first 32 bytes of the signature
* `s`, the second 32 bytes of the signature
* `rec_id`, the adjusted recovery identifier (usually `0` or `1`)

Since 0.10.6

[View this page on docs.chromia.com](https://docs.chromia.com/pages/rell-stdlib/-rell%20-system%20-library/crypto/eth_sign.html)Generated API reference, mirrored from the live docs
