Skip to content

Instantly share code, notes, and snippets.

@zjshen14
Created October 10, 2018 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zjshen14/020208400148bc80fcbee1a25e216c58 to your computer and use it in GitHub Desktop.
Save zjshen14/020208400148bc80fcbee1a25e216c58 to your computer and use it in GitHub Desktop.
const PublicKeyLength = 72
type PublicKey [PublicKeyLength]byte
func PublicKeyFromHex(hex string) PublicKey [72]byte { ... }
func PublicKeyFromBytes(bytes []byte) PublicKey [72]byte {
var pk PublicKey
if len(bytes) != PublicKeyLength {
return pk
}
cp(pk[:], bytes)
return pk
}
func (pk PublicKey) Hex() string { ... }
func (pk PublicKey) Bytes() string { return pk[:] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment