Skip to main content

EdDSA

Git Source

EdDSA

Library for verifying EdDSA signatures on the Ed25519 curve

Implements signature verification and point decompression for EdDSA

Methods

verify

function verify(bytes memory message, bytes memory signature, bytes32 pubkey) public returns (bool) 

Verifies an EdDSA signature against a message and public key

Decompresses the public key, converts to Weierstrass form, and verifies using EIP-6565

Parameters

NameTypeDescription
messagebytes memoryThe message that was signed
signaturebytes memoryThe signature to verify, encoded as (r,s) coordinates
pubkeybytes32The compressed public key to verify against

Returns

NameTypeDescription
boolbool True if the signature is valid, false otherwise

edDecompress

function edDecompress(
uint256 KPubC
) public returns (uint256 x, uint256 y)

Decompresses an Ed25519 public key from its compressed form

from here https://github.com/get-smooth/crypto-lib/blob/f2c00ecced1df96fe81894d19a6b8ec754beedb9/test/libSCL_eip6565.t.sol#L44

If computed x doesn't match the sign bit, negates x mod p

Parameters

NameTypeDescription
KPubCuint256The compressed public key point in Edwards form, with sign bit in MSB

Returns

NameTypeDescription
xuint256x The x-coordinate of the decompressed point on Edwards curve
yuint256y The y-coordinate of the decompressed point on Edwards curve