The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
woop/crypto/utils.go

21 lines
531 B

package crypto
import (
"crypto/sha256"
"github.com/dedis/kyber"
)
func Hash(message string) [32]byte {
return sha256.Sum256([]byte(message))
}
func GetPublicKeyFromPrivateKey(suite Suite, priKey [32]byte) kyber.Point {
scalar := suite.Scalar()
scalar.UnmarshalBinary(priKey[:])
return suite.Point().Mul(scalar, nil)
}
// Same as GetPublicKeyFromPrivateKey, but it directly works on kyber.Scalar object.
func GetPublicKeyFromScalar(suite Suite, priKey kyber.Scalar) kyber.Point {
return suite.Point().Mul(priKey, nil)
}