btncrypt

package
v0.0.0-...-7570391 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BtnFrameMaxPayload = 256 * 1024
)

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(c *Cipher, envelope []byte, lenTotal int) ([]byte, error)

func Encrypt

func Encrypt(c *Cipher, plain []byte) ([]byte, error)

func KeyFromPassword

func KeyFromPassword(password string) []byte

Types

type Cipher

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

func NewCipher

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

func (*Cipher) DecryptFrame

func (c *Cipher) DecryptFrame(dst []byte, p []byte) ([]byte, error)

func (*Cipher) EncryptFrame

func (c *Cipher) EncryptFrame(dst []byte, p []byte) []byte

func (*Cipher) EncryptedFrameSize

func (c *Cipher) EncryptedFrameSize(payloadLen int) int

func (*Cipher) FrameOverhead

func (c *Cipher) FrameOverhead() int

func (*Cipher) GetDecryptedFrameBuf

func (c *Cipher) GetDecryptedFrameBuf() []byte

func (*Cipher) GetEncryptedFrameBuf

func (c *Cipher) GetEncryptedFrameBuf() []byte

func (*Cipher) NewReader

func (c *Cipher) NewReader(src io.Reader, lenTotal int) (*Reader, error)

func (*Cipher) NewWriteCloser

func (c *Cipher) NewWriteCloser(dst io.Writer, lenTotal int) (*WriteCloser, error)

func (*Cipher) PutDecryptedFrameBuf

func (c *Cipher) PutDecryptedFrameBuf(p []byte)

func (*Cipher) PutEncryptedFrameBuf

func (c *Cipher) PutEncryptedFrameBuf(p []byte)

type Reader

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

func (*Reader) Close

func (bdr *Reader) Close() error

func (*Reader) HasReadAll

func (bdr *Reader) HasReadAll() bool

func (*Reader) Read

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

type WriteCloser

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

func (*WriteCloser) Close

func (bew *WriteCloser) Close() error

func (*WriteCloser) Write

func (bew *WriteCloser) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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