streamCipher

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCipherMethod

func CheckCipherMethod(method string) error

Types

type DecOrEnc

type DecOrEnc int
const (
	Decrypt DecOrEnc = iota
	Encrypt
)

type NoneStream

type NoneStream struct {
	cipher.Stream
}

func (*NoneStream) XORKeyStream

func (*NoneStream) XORKeyStream(dst, src []byte)

type StreamCipher

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

func NewStreamCipher

func NewStreamCipher(method, password string) (c *StreamCipher, err error)

NewStreamCipher creates a cipher that can be used in Dial() etc. Use cipher.Copy() to create a new cipher with the same method and password to avoid the cost of repeated cipher initialization.

func (*StreamCipher) Copy

func (c *StreamCipher) Copy() *StreamCipher

Copy creates a new cipher at it's initial state.

func (*StreamCipher) Decrypt

func (c *StreamCipher) Decrypt(dst, src []byte)

func (*StreamCipher) DecryptInited

func (c *StreamCipher) DecryptInited() bool

func (*StreamCipher) Encrypt

func (c *StreamCipher) Encrypt(dst, src []byte)

func (*StreamCipher) EncryptInited

func (c *StreamCipher) EncryptInited() bool

func (*StreamCipher) IV

func (c *StreamCipher) IV() []byte

func (*StreamCipher) InfoIVLen

func (c *StreamCipher) InfoIVLen() int

func (*StreamCipher) InfoKeyLen

func (c *StreamCipher) InfoKeyLen() int

func (*StreamCipher) InitDecrypt

func (c *StreamCipher) InitDecrypt(iv []byte) (err error)

func (*StreamCipher) InitEncrypt

func (c *StreamCipher) InitEncrypt() (iv []byte, err error)

Initializes the block cipher with CFB mode, returns IV.

func (*StreamCipher) Key

func (c *StreamCipher) Key() []byte

func (*StreamCipher) SetIV

func (c *StreamCipher) SetIV(iv []byte)

func (*StreamCipher) SetKey

func (c *StreamCipher) SetKey(key []byte)

Jump to

Keyboard shortcuts

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