crypto

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package crypto implements a variant of the STREAM chunked encryption scheme.

Index

Constants

View Source
const ChunkSize = 64 * 1024
View Source
const StreamNonceSize = 16

StreamNonceSize is the size of the nonce used during streaming.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(src io.Reader, mk []byte) (io.Reader, error)

Decrypt takes the given source and master key and return a decrypter reader.

func Encrypt

func Encrypt(dst io.WriteCloser, mk []byte) (io.WriteCloser, error)

Encrypt takes the given destination and master key and return a encrypter writer.

func NewPassword

func NewPassword(length int) string

NewPassword generates a new password for the given length.

Types

type Reader

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

func NewReader

func NewReader(key []byte, src io.Reader) (*Reader, error)

func (*Reader) Read

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

type Writer

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

func NewWriter

func NewWriter(key []byte, dst io.WriteCloser) (*Writer, error)

func (*Writer) Close

func (w *Writer) Close() error

Close will flush the last chunk and call the underlying WriteCloser's Close method.

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