mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
18 lines
465 B
Go
18 lines
465 B
Go
|
package p2p
|
||
|
|
||
|
import (
|
||
|
"encoding/base64"
|
||
|
|
||
|
"github.com/libp2p/go-libp2p-pubsub/pb"
|
||
|
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
||
|
)
|
||
|
|
||
|
// Content addressable ID function.
|
||
|
//
|
||
|
// Loosely defined as Base64(sha2(data)) until a formal specification is determined.
|
||
|
// Pending: https://github.com/ethereum/eth2.0-specs/issues/1528
|
||
|
func msgIDFunction(pmsg *pubsub_pb.Message) string {
|
||
|
h := hashutil.FastSum256(pmsg.Data)
|
||
|
return base64.URLEncoding.EncodeToString(h[:])
|
||
|
}
|