Unverified Commit 6ef617de authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #7 from ipfs/feat/faster-b58

switch to a faster b58 library
parents ecb455b2 a5ec80ae
......@@ -7,15 +7,15 @@
"gxDependencies": [
{
"author": "multiformats",
"hash": "QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd",
"hash": "QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua",
"name": "go-multihash",
"version": "1.0.6"
"version": "1.0.7"
},
{
"author": "whyrusleeping",
"hash": "QmT8rehPR3F6bmwL6zjUN8XpiDBFFpMP2myPdC6ApsWfJf",
"name": "go-base58",
"version": "0.0.0"
"author": "mr-tron",
"hash": "QmWFAMPqsEyUX7gDUsRVmMWz59FxSpJ1b2v6bJ1yYzo7jY",
"name": "go-base58-fast",
"version": "0.1.1"
}
],
"gxVersion": "0.9.1",
......
......@@ -12,7 +12,7 @@ import (
"strings"
"time"
b58 "github.com/jbenet/go-base58"
b58 "github.com/mr-tron/base58/base58"
mh "github.com/multiformats/go-multihash"
)
......@@ -140,15 +140,12 @@ func Hash(data []byte) mh.Multihash {
// IsValidHash checks whether a given hash is valid (b58 decodable, len > 0)
func IsValidHash(s string) bool {
out := b58.Decode(s)
if out == nil || len(out) == 0 {
return false
}
_, err := mh.Cast(out)
out, err := b58.Decode(s)
if err != nil {
return false
}
return true
_, err = mh.Cast(out)
return err == nil
}
// XOR takes two byte slices, XORs them together, returns the resulting slice.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment