Documentation ¶
Index ¶
- Variables
- func AddrFromPubKey(pubkey []byte) string
- func Base58Decode(str string) []byte
- func Base58Encode(payload []byte) string
- func ByteArrayToHex(payload []byte) string
- func CreateAEAD(key []byte) (cipher.AEAD, error)
- func DecryptGCM(ciphertext []byte, key []byte) ([]byte, error)
- func DoubleSHA256(b []byte) []byte
- func EncryptGCM(plaintext []byte, key []byte) ([]byte, error)
- func GetSHA256Hash(b []byte) []byte
- func GetSHA3384Hash(str []byte) ([]byte, error)
- func PadKey(key []byte) []byte
- func PubKeyFromAddress(address string) (*secp256k1.PublicKey, error)
- func VerifySchnorrSignature(pubKey *secp256k1.PublicKey, sig []byte, data []byte) bool
- func VerifySignature(pub *secp256k1.PublicKey, sig []byte, msg []byte) bool
- type KeyPair
- func (k *KeyPair) Encrypt(message []byte, recepientPubKey *secp256k1.PublicKey) ([]byte, error)
- func (k *KeyPair) Generate() error
- func (k *KeyPair) GetAddr() string
- func (k *KeyPair) GetPrivKey() string
- func (k *KeyPair) GetPubKey() string
- func (k *KeyPair) GetPubKeyHashFromAddr(str string) ([]byte, error)
- func (k *KeyPair) GetPubKeyUncompressed() string
- func (k *KeyPair) SchnorrSign(data []byte) ([]byte, error)
- func (k *KeyPair) Sign(message []byte) (*ecdsa.Signature, error)
- type PRBG
Constants ¶
This section is empty.
Variables ¶
var ( // HashStrategy is the hash strategy for SHA3-384. HashStrategy func() hash.Hash = sha3.New384 )
Functions ¶
func AddrFromPubKey ¶
AddrFromPubKey generates an address the same way it's generated for Bitcoin.
func Base58Decode ¶
Base58Decode decodes a base58 encoded string.
func Base58Encode ¶
Base58Encode encodes a series of bytes into a base58 string.
func ByteArrayToHex ¶
ByteArrayToHex converts a set of bytes to a hex encoded string.
func CreateAEAD ¶
CreateAEAD creates a new authenticated encryption with associated data.
func DecryptGCM ¶
DecryptGCM decrypts an AES/GCM encrypted ciphertext.
func DoubleSHA256 ¶
DoubleSHA256 generates the double SHA256 hash of the input.
func EncryptGCM ¶
EncryptGCM encrypts the plaintext with AES/GCM.
func GetSHA3384Hash ¶
GetSHA3384Hash returns the SHA3-512 hash of a given string.
func PubKeyFromAddress ¶
PubKeyFromAddress decodes an address and returns the public key.
func VerifySchnorrSignature ¶
VerifySchnorrSignature verifies the given Schnorr signature.
func VerifySignature ¶
VerifySignature verifies a DER signature.
Types ¶
type KeyPair ¶
type KeyPair struct { Public *secp256k1.PublicKey Private *secp256k1.PrivateKey }
KeyPair represents a structure for managing encryption keys.
func PrivKeyFromBytes ¶
PrivKeyFromBytes gets the private key from bytes.
func (*KeyPair) Encrypt ¶
Encrypt a message with a temporary key and a shared secret derived from AEAD AES GCM.
func (*KeyPair) GetPrivKey ¶
GetPrivKey returns the private key.
func (*KeyPair) GetPubKeyHashFromAddr ¶
GetPubKeyHashFromAddr gets the public key hash from the address.
func (*KeyPair) GetPubKeyUncompressed ¶
GetPubKeyUncompressed gets the uncompressed version of the public key.
func (*KeyPair) SchnorrSign ¶
SchnorrSign creates a Schnorr signature of the given data.
type PRBG ¶
type PRBG struct { Seed []byte // contains filtered or unexported fields }
PRBG is the struct representing our pseud-random byte generator object.
func (*PRBG) NextUInt64 ¶
NextUInt64 gets the next set of random integer.