This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
go-monero/pkg/monero/crypto.go

27 lines
493 B
Go

package monero
import (
"git.gammaspectra.live/P2Pool/moneroutil"
"golang.org/x/crypto/sha3"
)
func keccak256(data ...[]byte) []byte {
hash := sha3.NewLegacyKeccak256()
for _, v := range data {
hash.Write(v)
}
return hash.Sum(nil)
}
func publicKeyFromPrivateKey(private []byte) []byte {
public := make([]byte, KeySize)
p := new(moneroutil.ExtendedGroupElement)
moneroutil.GeScalarMultBase(p, (*moneroutil.Key)(private))
p.ToBytes((*moneroutil.Key)(public))
return public
}