Skip to content

Commit

Permalink
fixup! ellswift: introduce ElligatorSwift encoding and decoding funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Crypt-iQ committed Sep 27, 2024
1 parent 07fdd09 commit c59605c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions btcec/ellswift.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion btcec/ellswift_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ func TestXSwiftECInvVectors(t *testing.T) {
t.Fatalf("t value different than expected")
}

return
continue
}

expectedT := setHex(expTString)
Expand Down

0 comments on commit c59605c

Please sign in to comment.