Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
update secp256k1 dependency (#42)
Browse files Browse the repository at this point in the history
Signed-off-by: bytemare <[email protected]>
  • Loading branch information
bytemare authored Apr 21, 2023
1 parent b51f99f commit 8b2734a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The following table indexes supported groups with hash-to-curve capability and l
| 4 | P-384 | filippo.io/nistec |
| 5 | P-521 | filippo.io/nistec |
| 6 | Edwards25519 | filippo.io/edwards25519 |
| 7 | Secp256k1 | github.com/bytemare/crypto |
| 7 | Secp256k1 | github.com/bytemare/secp256k1 |
| 8 | Double-Odd | not yet supported |

## Prime-order group interface
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
filippo.io/edwards25519 v1.0.0
filippo.io/nistec v0.0.2
github.com/bytemare/hash2curve v0.2.2
github.com/bytemare/secp256k1 v0.0.0-20230421210201-f2244bd0effa
github.com/bytemare/secp256k1 v0.1.0
github.com/gtank/ristretto255 v0.1.2
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/bytemare/hash v0.1.5 h1:VW+X1YQ2b3chjRFHkRUnO42uclsQjXimdBCPOgIobR4=
github.com/bytemare/hash v0.1.5/go.mod h1:+QmWXTky/2b63ngqM5IYezGydn9UTFDhpX7mLYwYxCA=
github.com/bytemare/hash2curve v0.2.2 h1:zaGx6Z4/N4Pl9B7aGNtpbZ09vu1NNJGoJRRtHHl8oTw=
github.com/bytemare/hash2curve v0.2.2/go.mod h1:Wma3DmJdn8kqiK9j120hkWvC3tQVKS1PyA8ZzyG23BI=
github.com/bytemare/secp256k1 v0.0.0-20230421210201-f2244bd0effa h1:vrXhOGi25aItUpmJo1ItTZhcv5L7U9/1vdcxL+pKa88=
github.com/bytemare/secp256k1 v0.0.0-20230421210201-f2244bd0effa/go.mod h1:hzquMsr3GXhVcqL9qFX7GGjmcT5dlQldKrArd7tcXHE=
github.com/bytemare/secp256k1 v0.1.0 h1:kjVJ06GAHSa+EJ7Rz1LdVgE0DQWdvUT77tmcGf7epXQ=
github.com/bytemare/secp256k1 v0.1.0/go.mod h1:hzquMsr3GXhVcqL9qFX7GGjmcT5dlQldKrArd7tcXHE=
github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc=
github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o=
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
Expand Down
8 changes: 3 additions & 5 deletions internal/secp256k1/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const (
elementLength = 33
)

var group = secp256k1.New()

// Group represents the Secp256k1 group. It exposes a prime-order group API with hash-to-curve operations.
type Group struct{}

Expand All @@ -55,19 +53,19 @@ func (g Group) Base() internal.Element {
// HashToScalar returns a safe mapping of the arbitrary input to a Scalar.
// The DST must not be empty or nil, and is recommended to be longer than 16 bytes.
func (g Group) HashToScalar(input, dst []byte) internal.Scalar {
return &Scalar{scalar: group.HashToScalar(input, dst)}
return &Scalar{scalar: secp256k1.HashToScalar(input, dst)}
}

// HashToGroup returns a safe mapping of the arbitrary input to an Element in the Group.
// The DST must not be empty or nil, and is recommended to be longer than 16 bytes.
func (g Group) HashToGroup(input, dst []byte) internal.Element {
return &Element{element: group.HashToGroup(input, dst)}
return &Element{element: secp256k1.HashToGroup(input, dst)}
}

// EncodeToGroup returns a non-uniform mapping of the arbitrary input to an Element in the Group.
// The DST must not be empty or nil, and is recommended to be longer than 16 bytes.
func (g Group) EncodeToGroup(input, dst []byte) internal.Element {
return &Element{element: group.EncodeToGroup(input, dst)}
return &Element{element: secp256k1.EncodeToGroup(input, dst)}
}

// Ciphersuite returns the hash-to-curve ciphersuite identifier.
Expand Down

0 comments on commit 8b2734a

Please sign in to comment.