use full secret hash including prefix byte 0x02 / 0x03

This commit is contained in:
Jaremy Creechley 2023-07-17 20:04:58 -07:00
parent 486d5f2326
commit 9cb9f6677f
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300

View File

@ -89,7 +89,7 @@ func ecdhSharedSecretFull*(seckey: PrivateKey, pubkey: PublicKey): SharedSecretF
proc ecdhRaw*( proc ecdhRaw*(
priv: PrivateKey, priv: PrivateKey,
pub: PublicKey pub: PublicKey
): Result[SharedSecret, cstring] = ): Result[SharedSecretFull, cstring] =
## emulate old ecdhRaw style keys ## emulate old ecdhRaw style keys
## ##
## this includes a leading 0x02 or 0x03 ## this includes a leading 0x02 or 0x03
@ -98,4 +98,4 @@ proc ecdhRaw*(
if priv.scheme != Secp256k1 or pub.scheme != Secp256k1: if priv.scheme != Secp256k1 or pub.scheme != Secp256k1:
return err "Must use secp256k1 scheme".cstring return err "Must use secp256k1 scheme".cstring
ok ecdhSharedSecret(priv.skkey, pub.skkey) ok ecdhSharedSecretFull(priv, pub)