aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/btcsuite/btcd/btcec/pubkey.go
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2017-12-13 17:23:11 +0800
committerJanos Guljas <janos@resenje.org>2017-12-13 17:40:39 +0800
commit19982f946735948478b6b7e7706f1b615f171d0d (patch)
treecbacbdb6f9e6e731c2ebc17bad74e875f4d8ea8b /vendor/github.com/btcsuite/btcd/btcec/pubkey.go
parent1dc19de5da64962a98a37bbc7b93a3895d2eb6e6 (diff)
parent32516c768ec09e2a71cab5983d2c8b8ae5d92fc7 (diff)
downloadgo-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.gz
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.bz2
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.lz
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.xz
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.zst
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.zip
swarm, cmd/swarm: Merge branch 'master' into multiple-ens-endpoints
Merge with changes that implement config file PR #15548. Field *EnsApi string* in swarm/api.Config is replaced with *EnsAPIs []string*. A new field *EnsDisabled bool* is added to swarm/api.Config for easy way to disable ENS resolving with config file. Signature of function swarm.NewSwarm is changed and simplified.
Diffstat (limited to 'vendor/github.com/btcsuite/btcd/btcec/pubkey.go')
-rw-r--r--vendor/github.com/btcsuite/btcd/btcec/pubkey.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/vendor/github.com/btcsuite/btcd/btcec/pubkey.go b/vendor/github.com/btcsuite/btcd/btcec/pubkey.go
index f145414ec..b74917718 100644
--- a/vendor/github.com/btcsuite/btcd/btcec/pubkey.go
+++ b/vendor/github.com/btcsuite/btcd/btcec/pubkey.go
@@ -54,6 +54,15 @@ const (
pubkeyHybrid byte = 0x6 // y_bit + x coord + y coord
)
+// IsCompressedPubKey returns true the the passed serialized public key has
+// been encoded in compressed format, and false otherwise.
+func IsCompressedPubKey(pubKey []byte) bool {
+ // The public key is only compressed if it is the correct length and
+ // the format (first byte) is one of the compressed pubkey values.
+ return len(pubKey) == PubKeyBytesLenCompressed &&
+ (pubKey[0]&^byte(0x1) == pubkeyCompressed)
+}
+
// ParsePubKey parses a public key for a koblitz curve from a bytestring into a
// ecdsa.Publickey, verifying that it is valid. It supports compressed,
// uncompressed and hybrid signature formats.