mirror of
https://github.com/status-im/go-waku.git
synced 2025-02-05 18:33:33 +00:00
16 lines
329 B
Go
16 lines
329 B
Go
|
package noise
|
||
|
|
||
|
import (
|
||
|
"crypto/ed25519"
|
||
|
"crypto/sha256"
|
||
|
)
|
||
|
|
||
|
// Commits a public key pk for randomness r as H(pk || s)
|
||
|
func CommitPublicKey(publicKey ed25519.PublicKey, r []byte) []byte {
|
||
|
input := []byte{}
|
||
|
input = append(input, []byte(publicKey)...)
|
||
|
input = append(input, r...)
|
||
|
res := sha256.Sum256(input)
|
||
|
return res[:]
|
||
|
}
|