From c59605ca34222f7b3ab38110901beaa4a114ffcf Mon Sep 17 00:00:00 2001 From: Eugene Siegel Date: Thu, 26 Sep 2024 23:59:36 -0400 Subject: [PATCH] fixup! ellswift: introduce ElligatorSwift encoding and decoding funcs --- btcec/ellswift.go | 7 ++++--- btcec/ellswift_test.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/btcec/ellswift.go b/btcec/ellswift.go index 02346357eaa..7bc678c7355 100644 --- a/btcec/ellswift.go +++ b/btcec/ellswift.go @@ -18,6 +18,8 @@ var ( 0x7d, 0x8d, 0x27, 0xae, 0x1c, 0xd5, 0xf8, 0x52, } + ellswiftTag = []byte("bip324_ellswift_xonly_ecdh") + // ErrPointNotOnCurve is returned when we're unable to find a point on the // curve. ErrPointNotOnCurve = fmt.Errorf("point does not exist on secp256k1 curve") @@ -379,13 +381,12 @@ func V2Ecdh(priv *PrivateKey, ellswiftTheirs, ellswiftOurs [64]byte, msg = append(msg, ellswiftOurs[:]...) msg = append(msg, ellswiftTheirs[:]...) msg = append(msg, ecdhPoint[:]...) - return chainhash.TaggedHash([]byte("bip324_ellswift_xonly_ecdh"), msg), - nil + return chainhash.TaggedHash(ellswiftTag, msg), nil } var msg []byte msg = append(msg, ellswiftTheirs[:]...) msg = append(msg, ellswiftOurs[:]...) msg = append(msg, ecdhPoint[:]...) - return chainhash.TaggedHash([]byte("bip324_ellswift_xonly_ecdh"), msg), nil + return chainhash.TaggedHash(ellswiftTag, msg), nil } diff --git a/btcec/ellswift_test.go b/btcec/ellswift_test.go index d4e85db6672..94fa6fbd2db 100644 --- a/btcec/ellswift_test.go +++ b/btcec/ellswift_test.go @@ -806,7 +806,7 @@ func TestXSwiftECInvVectors(t *testing.T) { t.Fatalf("t value different than expected") } - return + continue } expectedT := setHex(expTString)