mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
crypto: use golangci-lint (#20295)
This commit is contained in:
parent
e1eb00ef99
commit
6033722b72
2 changed files with 6 additions and 22 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import (
|
|||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue