Skip to content

Commit

Permalink
Merge pull request #404 from aeternity/PT-167996886-a_proper_ecverify
Browse files Browse the repository at this point in the history
Add info about ecrecover and ecverify
  • Loading branch information
hanssv authored Aug 21, 2019
2 parents 0cff217 + 9176b21 commit eb2f719
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions contracts/sophia.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,13 +633,25 @@ string`, `String.sha3(s)` and `Crypto.sha3(s)` gives different results.
There are also functions for signature verification:

```
Crypto.ecverify(msg : hash, pubkey : address, sig : signature) : bool
Crypto.ecverify_secp256k1(msg : hash, pubkey : bytes(64), sig : bytes(64)) : bool
Crypto.verify_sig(msg : hash, pubkey : address, sig : signature) : bool
Crypto.verify_sig_secp256k1(msg : hash, pubkey : bytes(64), sig : bytes(64)) : bool
```

The signature verification returns true if `sig` is the signature of `msg`
using the private key corresponding to `pubkey`.

The function `ecrecover_secp256k1` allows one to recover the
Ethereum style address from a msg hash and respective signature, and
`ecverify_secp256k1` will verify a signature for a msg hash against
an Ethereum style address:

```
Crypto.ecverify_secp256k1(msg : hash, addr : bytes(20), sig : bytes(65)) : bool
Crypto.ecrecover_secp256k1(msg : hash, sig : bytes(65)) : option(bytes(20))
```

*Note*: Before Sophia version 4, `verify_sig` was (incorrectly) named `ecverify`.

#### Authorization interface

When a Generalized account is authorized, the authorization function needs
Expand Down

0 comments on commit eb2f719

Please sign in to comment.