move into p2p package

This commit is contained in:
Ethan Buchman
2017-04-21 18:07:52 -04:00
parent 63f546497b
commit 23a6a6f8fc
35 changed files with 0 additions and 0 deletions

15
p2p/util.go Normal file
View File

@@ -0,0 +1,15 @@
package p2p
import (
"crypto/sha256"
)
// doubleSha256 calculates sha256(sha256(b)) and returns the resulting bytes.
func doubleSha256(b []byte) []byte {
hasher := sha256.New()
hasher.Write(b)
sum := hasher.Sum(nil)
hasher.Reset()
hasher.Write(sum)
return hasher.Sum(nil)
}