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
9814eaec
Commit
9814eaec
authored
Mar 16, 2016
by
Chris P
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util: Add DefaultIpfsHash constant for programtically accessing the current default.
parent
8b6cc6f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
util.go
util.go
+4
-1
No files found.
util.go
View file @
9814eaec
...
...
@@ -16,6 +16,9 @@ import (
mh
"github.com/jbenet/go-multihash"
)
// DefaultIpfsHash is the current default hash function used by IPFS.
const
DefaultIpfsHash
=
mh
.
SHA2_256
// Debug is a global flag for debugging.
var
Debug
bool
...
...
@@ -115,7 +118,7 @@ func RPartition(subject string, sep string) (string, string, string) {
// Hash is the global IPFS hash function. uses multihash SHA2_256, 256 bits
func
Hash
(
data
[]
byte
)
mh
.
Multihash
{
h
,
err
:=
mh
.
Sum
(
data
,
mh
.
SHA2_256
,
-
1
)
h
,
err
:=
mh
.
Sum
(
data
,
DefaultIpfsHash
,
-
1
)
if
err
!=
nil
{
// this error can be safely ignored (panic) because multihash only fails
// from the selection of hash function. If the fn + length are valid, it
...
...
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