crypto

package
v0.0.0-...-828df2f Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChecksumLength   = errors.New("checksum is not long enough")
	ErrChecksumMismatch = errors.New("checkum mismatch")
)
View Source
var (
	ErrBytesWrittenUnexpected = errors.New("number of bytes written is unexpected")
	ErrBytesReadUnexpected    = errors.New("number of bytes read is unexpected")
)
View Source
var ErrCiphertextTooSmall = errors.New("ciphertext is too small")

Functions

This section is empty.

Types

type Crypto

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

func NewCrypto

func NewCrypto() *Crypto

func (*Crypto) Argon2ID

func (c *Crypto) Argon2ID(data []byte, time, memory uint32) (digest [argon2IDDigestSize]byte)

func (*Crypto) Checksumize

func (c *Crypto) Checksumize(data []byte) (checksumedData []byte, err error)

Checksumize adds a Shake 256 checksum to some data.

func (*Crypto) Dechecksumize

func (c *Crypto) Dechecksumize(checksumData []byte) (data []byte, err error)

Dechecksumize verifies the Shake 256 checksum of some data.

func (*Crypto) DecryptAES256

func (c *Crypto) DecryptAES256(ciphertext []byte, key [32]byte) (plaintext []byte, err error)

DecryptAES256 decrypts some ciphertext with a key using AES and returns the plaintext.

func (*Crypto) EncryptAES256

func (c *Crypto) EncryptAES256(plaintext []byte, key [32]byte) (ciphertext []byte, err error)

EncryptAES256 encrypts some plaintext with a key using AES and returns the ciphertext.

func (*Crypto) NewSalt

func (c *Crypto) NewSalt() (salt [saltSize]byte, err error)

func (*Crypto) ShakeSum256

func (c *Crypto) ShakeSum256(data []byte) (digest [shakeSum256DigestSize]byte, err error)

func (*Crypto) SignEd25519

func (c *Crypto) SignEd25519(message []byte, signingKey [signKeySize]byte) (signature []byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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