symmcipher

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Cipher

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

Cipher is a wrapper around the AEAD interface from the golang.org/x/crypto/chacha20poly1305 package.

func New

func New(key []byte) (*Cipher, error)

New returns a new Cipher instance. If a Cipher instance with the same key has already been created, it will be returned instead.

func (*Cipher) NewDecryptingReader added in v0.3.0

func (cipher *Cipher) NewDecryptingReader(src io.Reader) (io.ReadCloser, error)

NewDecryptingReader returns a new io.ReadCloser that decrypts src with the cipher

func (*Cipher) NewEncryptingWriter added in v0.3.0

func (cipher *Cipher) NewEncryptingWriter(dst io.Writer, compression bool) (io.WriteCloser, error)

NewEncryptingWriter returns a new io.WriteCloser that encrypts data with the cipher and writes to dst.

type Reader

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

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

type Writer

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

func (*Writer) Close

func (w *Writer) Close() error

Close flushes the last chunk. It does not close the underlying Writer.

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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