mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-13 23:31:19 +00:00
16 lines
331 B
Go
16 lines
331 B
Go
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) // error ignored
|
|
sum := hasher.Sum(nil)
|
|
hasher.Reset()
|
|
_, _ = hasher.Write(sum) // error ignored
|
|
return hasher.Sum(nil)
|
|
}
|