cryptography

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2023 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(s string) uint64

Decode decodes a base36-encoded string.

func DecodeToBytes

func DecodeToBytes(b string) []byte

DecodeToBytes decodes a base36 string to a byte slice, using alphabet.

func Encode

func Encode(value uint64) string

Encode encodes a number to base36.

func EncodeBytes

func EncodeBytes(b []byte) string

EncodeBytes encodes a byte slice to base36 string.

func EncodeBytesAsBytes

func EncodeBytesAsBytes(b []byte) []byte

EncodeBytesAsBytes encodes a byte slice to base36.

func GenerateKeypair added in v0.1.0

func GenerateKeypair() (PublicKeyStr, PrivateKeyStr, error)

GenerateKeypair generates a public and private keypair string

Types

type PrivateKey

type PrivateKey struct {
	D []byte
}

PrivateKey is a bytestream of data not converted to anything

func GenerateKey

func GenerateKey() (*PrivateKey, error)

GenerateKey generate a new random private key

func PrivateKeyFromString

func PrivateKeyFromString(private string) (*PrivateKey, error)

PrivateKeyFromString grabs a private key string and gives out a privatekey object

func (*PrivateKey) Decrypt added in v0.1.0

func (private *PrivateKey) Decrypt(data []byte) (decrypted []byte, err error)

Decrypt will provide a decryption mechanism for an arbitrary bytestream

func (*PrivateKey) Encrypt added in v0.1.0

func (private *PrivateKey) Encrypt(public *PublicKey, data []byte) (encrypted []byte, err error)

Encrypt will provide a encryption mechanism for an arbitrary bytestream

func (PrivateKey) GetPublicKey

func (private PrivateKey) GetPublicKey() PublicKey

GetPublicKey returns a PublicKey object from the key

func (PrivateKey) String

func (private PrivateKey) String() PrivateKeyStr

String marshaller for private key

type PrivateKeyStr added in v0.1.0

type PrivateKeyStr string

type PublicKey

type PublicKey struct {
	elliptic.Curve
	X, Y *big.Int
}

PublicKey has the curve and the X,Y.

func GetPublicKeyFromMessage

func GetPublicKeyFromMessage(msg []byte) *PublicKey

GetPublicKeyFromMessage is a helper function to extract first 32 bytes from a long message, and provide the sender public key of it

func PublicKeyFromString

func PublicKeyFromString(public PublicKeyStr) (*PublicKey, error)

PublicKeyFromString grabs a public key string and gives out a publickey object

func (PublicKey) String

func (key PublicKey) String() PublicKeyStr

String marshaller for public key

type PublicKeyStr added in v0.1.0

type PublicKeyStr string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL