Skip to content

Commit

Permalink
crypto: use golangci-lint (ethereum#20295)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Dec 2, 2024
1 parent ba33c09 commit 51f52e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
11 changes: 6 additions & 5 deletions crypto/bn256/bn256_fast.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@
// Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve.
package bn256

import "github.com/XinFinOrg/XDPoSChain/crypto/bn256/cloudflare"

import (
bn256cf "github.com/XinFinOrg/XDPoSChain/crypto/bn256/cloudflare"
)
// G1 is an abstract cyclic group. The zero value is suitable for use as the
// output of an operation, but cannot be used as an input.
type G1 = bn256.G1
type G1 = bn256cf.G1

// G2 is an abstract cyclic group. The zero value is suitable for use as the
// output of an operation, but cannot be used as an input.
type G2 = bn256.G2
type G2 = bn256cf.G2

// PairingCheck calculates the Optimal Ate pairing for a set of points.
func PairingCheck(a []*G1, b []*G2) bool {
return bn256.PairingCheck(a, b)
return bn256cf.PairingCheck(a, b)
}
17 changes: 0 additions & 17 deletions crypto/ecies/ecies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"math/big"
"testing"

Expand Down Expand Up @@ -67,22 +66,6 @@ func cmpParams(p1, p2 *ECIESParams) bool {
p1.BlockSize == p2.BlockSize
}

// cmpPublic returns true if the two public keys represent the same pojnt.
func cmpPublic(pub1, pub2 PublicKey) bool {
if pub1.X == nil || pub1.Y == nil {
fmt.Println(ErrInvalidPublicKey.Error())
return false
}
if pub2.X == nil || pub2.Y == nil {
fmt.Println(ErrInvalidPublicKey.Error())
return false
}
pub1Out := elliptic.Marshal(pub1.Curve, pub1.X, pub1.Y)
pub2Out := elliptic.Marshal(pub2.Curve, pub2.X, pub2.Y)

return bytes.Equal(pub1Out, pub2Out)
}

// Validate the ECDH component.
func TestSharedKey(t *testing.T) {
prv1, err := GenerateKey(rand.Reader, DefaultCurve, nil)
Expand Down

0 comments on commit 51f52e0

Please sign in to comment.