OSDN Git Service
(root)
/
bytom
/
bytom-spv.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
2be320263a9f8974597b680bc09bb979ff51f9cd
[bytom/bytom-spv.git]
/
p2p
/
util.go
1
package p2p
2
3
import (
4
"crypto/sha256"
5
)
6
7
// doubleSha256 calculates sha256(sha256(b)) and returns the resulting bytes.
8
func doubleSha256(b []byte) []byte {
9
hasher := sha256.New()
10
hasher.Write(b)
11
sum := hasher.Sum(nil)
12
hasher.Reset()
13
hasher.Write(sum)
14
return hasher.Sum(nil)
15
}