OSDN Git Service
(root)
/
bytom
/
bytom.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Adjust peer ban scoring strategy
[bytom/bytom.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
}