mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-17 02:47:51 +01:00
* added upload status * added changes for progress bar with more logs and bug fixes, Documentation yet to be added * huge changes that need more doucmenting * added possibility to get profile using NodeID * added fix profile listing user profile information * removed profile image from the explore reult struct * saving current changes * added filter to search based on NodeID * Monday bug fixing * updates to the profile * changes for tracing the blockchain profile image not shown * added condition to ensure TAG is not sent and removed debug prints * updated webapi docs
28 lines
730 B
Go
28 lines
730 B
Go
/*
|
|
File Username: Hash.go
|
|
Copyright: 2021 Peernet s.r.o.
|
|
Author: Peter Kleissner
|
|
*/
|
|
|
|
package protocol
|
|
|
|
import (
|
|
"github.com/PeernetOfficial/core/btcec"
|
|
"lukechampine.com/blake3"
|
|
)
|
|
|
|
// HashData abstracts the hash function.
|
|
func HashData(data []byte) (hash []byte) {
|
|
hash32 := blake3.Sum256(data)
|
|
return hash32[:]
|
|
}
|
|
|
|
// HashSize is blake3 hash digest size = 256 bits
|
|
const HashSize = 32
|
|
|
|
// PublicKey2NodeID translates the Public Key into the node ID used in the Kademlia network.
|
|
// It is also referenced in various other places including blockchain data at runtime. The node ID identifies the owner.
|
|
func PublicKey2NodeID(publicKey *btcec.PublicKey) (nodeID []byte) {
|
|
return HashData(publicKey.SerializeCompressed())
|
|
}
|