-
Notifications
You must be signed in to change notification settings - Fork 706
Open
Milestone
Description
Implement the new secp256r1 functions as described in the SIP:
-
secp256r1-recover?
- Input:
(buff 32), (buff 65)
- Output:
(response (buff 33) uint)
- Signature:
(secp256r1-recover? message-hash signature)
- Description: The
secp256r1-recover?
function recovers the public key
used to sign the message whose SHA-256 hash ismessage-hash
using the
providedsignature
. If the signature does not match the message hash, it
returns(err u1)
. If the signature is invalid or malformed, it returns
(err u2)
. The signature is expected to be 65 bytes (64 bytes of compact
signature data plus a recovery id in the final byte). - Example:
(secp256r1-recover? 0x033510403a646d23ee4f005061c2ca6af5da7c32c83758e8e9b6ac4cc1c2153c 0x9608dc164b76d2e19365ffa67b48981e441d323c3109718aee245d6ac8ccd21ddadadb94303c922c0d79d131ea59a0b6ba83e1157695db01189bb4b7e9f14b7200) ;; Returns (ok 0x037a6b62e3c8b14f1b5933f5d5ab0509a8e7d95a111b8d3b264d95bfa753b00296)
- Input:
-
secp256r1-verify
- Input:
(buff 32), (buff 64) | (buff 65), (buff 33)
- Output:
bool
- Signature:
(secp256r1-verify message-hash signature public-key)
- Description: The
secp256r1-verify
function verifies that the provided
signature
of themessage-hash
was produced by the private key
corresponding topublic-key
. Themessage-hash
is the SHA-256 hash of the
message. Thesignature
may be 64 bytes (compact signature) or 65 bytes
including an optional recovery id. Returnstrue
if the signature is valid
for the givenpublic-key
and message hash, otherwise returnsfalse
. - Example:
(secp256r1-verify 0x033510403a646d23ee4f005061c2ca6af5da7c32c83758e8e9b6ac4cc1c2153c 0x9608dc164b76d2e19365ffa67b48981e441d323c3109718aee245d6ac8ccd21ddadadb94303c922c0d79d131ea59a0b6ba83e1157695db01189bb4b7e9f14b7200 0x037a6b62e3c8b14f1b5933f5d5ab0509a8e7d95a111b8d3b264d95bfa753b00296) ;; Returns true (secp256r1-verify 0x0000000000000000000000000000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0x037a6b62e3c8b14f1b5933f5d5ab0509a8e7d95a111b8d3b264d95bfa753b00296) ;; Returns false
- Input:
Rapha-btc
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Status: π Backlog