crypt

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AES256GCM added in v1.2.1

type AES256GCM struct {
	// contains filtered or unexported fields
}

func (*AES256GCM) Decrypt added in v1.2.1

func (r *AES256GCM) Decrypt(payload string) ([]byte, error)

Decrypt decrypts the given base64 encoded payload, and returns the plaintext.

func (*AES256GCM) Encrypt added in v1.2.1

func (r *AES256GCM) Encrypt(plaintext []byte) (string, error)

Encrypt encrypts the given plaintext, and returns the base64 encoded payload.

type Crypter

type Crypter interface {
	Encrypt(plaintext []byte) (string, error)
	Decrypt(payload string) ([]byte, error)
}

func NewAES256GCM added in v1.2.1

func NewAES256GCM(key []byte) (Crypter, error)

NewAES256GCM returns a new AES256GCM crypt instance.

func NewXChacha20Poly1305

func NewXChacha20Poly1305(key []byte) (Crypter, error)

NewXChacha20Poly1305 returns a new XChacha20Poly1305 crypt instance.

type XChacha20Poly1305

type XChacha20Poly1305 struct {
	// contains filtered or unexported fields
}

func (*XChacha20Poly1305) Decrypt

func (r *XChacha20Poly1305) Decrypt(payload string) ([]byte, error)

Decrypt decrypts the given base64 encoded payload, and returns the plaintext.

func (*XChacha20Poly1305) Encrypt

func (r *XChacha20Poly1305) Encrypt(plaintext []byte) (string, error)

Encrypt encrypts the given plaintext, and returns the base64 encoded payload.

Jump to

Keyboard shortcuts

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