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
Commits
61ac7191
Commit
61ac7191
authored
10 years ago
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
global hash func
parent
56b3dafb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
merkledag/merkledag.go
merkledag/merkledag.go
+1
-1
util/util.go
util/util.go
+6
-0
No files found.
merkledag/merkledag.go
View file @
61ac7191
...
...
@@ -72,7 +72,7 @@ func (n *Node) Multihash() (mh.Multihash, error) {
return
nil
,
err
}
return
mh
.
Sum
(
b
,
mh
.
SHA2_256
,
-
1
)
return
u
.
Hash
(
b
)
}
func
(
n
*
Node
)
Key
()
(
u
.
Key
,
error
)
{
...
...
This diff is collapsed.
Click to expand it.
util/util.go
View file @
61ac7191
...
...
@@ -2,6 +2,7 @@ package util
import
(
"fmt"
mh
"github.com/jbenet/go-multihash"
"os"
)
...
...
@@ -11,6 +12,11 @@ var NotImplementedError = fmt.Errorf("Error: not implemented yet.")
// a Key for maps. It's a string (rep of a multihash).
type
Key
string
// global hash function. uses multihash SHA2_256, 256 bits
func
Hash
(
data
[]
byte
)
(
mh
.
Multihash
,
error
)
{
return
mh
.
Sum
(
data
,
mh
.
SHA2_256
,
-
1
)
}
// Shorthand printing functions.
func
PErr
(
format
string
,
a
...
interface
{})
{
fmt
.
Fprintf
(
os
.
Stderr
,
format
,
a
...
)
...
...
This diff is collapsed.
Click to expand 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