Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-util
Commits
6ef617de
Unverified
Commit
6ef617de
authored
Dec 18, 2017
by
Steven Allen
Committed by
GitHub
Dec 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7 from ipfs/feat/faster-b58
switch to a faster b58 library
parents
ecb455b2
a5ec80ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
package.json
package.json
+6
-6
util.go
util.go
+4
-7
No files found.
package.json
View file @
6ef617de
...
...
@@ -7,15 +7,15 @@
"gxDependencies"
:
[
{
"author"
:
"multiformats"
,
"hash"
:
"Qm
YeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd
"
,
"hash"
:
"Qm
ZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua
"
,
"name"
:
"go-multihash"
,
"version"
:
"1.0.
6
"
"version"
:
"1.0.
7
"
},
{
"author"
:
"
whyrusleeping
"
,
"hash"
:
"Qm
T8rehPR3F6bmwL6zjUN8XpiDBFFpMP2myPdC6ApsWfJf
"
,
"name"
:
"go-base58"
,
"version"
:
"0.
0.0
"
"author"
:
"
mr-tron
"
,
"hash"
:
"Qm
WFAMPqsEyUX7gDUsRVmMWz59FxSpJ1b2v6bJ1yYzo7jY
"
,
"name"
:
"go-base58
-fast
"
,
"version"
:
"0.
1.1
"
}
],
"gxVersion"
:
"0.9.1"
,
...
...
util.go
View file @
6ef617de
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment