Versions in this module Expand all Collapse all v0 v0.0.1 Jun 15, 2021 Changes in this version + var ErrInputInvalidLength = errors.New("encoded message length must be more than zero") + var ErrInputNotMoreABlock = errors.New("decoded message length must be more than a block size") + var ErrInputNotMultipleBlocks = errors.New("decoded message length must be multiple of block size") + var ErrInvalidIvSize = errors.New("iv length must equal block size") + var ErrUnPaddingOutOfRange = errors.New("unPadding out of range") + func CipherMethods() []string + func Evp2Key(password string, keyLen int) (key []byte) + func HasCipherMethod(method string) (ok bool) + func NewBlowfishCipher(key []byte) (cipher.Block, error) + func NewCast5Cipher(key []byte) (cipher.Block, error) + func NewChacha20(key, iv []byte) (cipher.Stream, error) + func NewRc4Md5(key, iv []byte) (cipher.Stream, error) + func NewSalsa20(key, iv []byte) (cipher.Stream, error) + func NewStream(method string, key, iv []byte, encrypt bool) (cipher.Stream, error) + func NewTwofishCipher(key []byte) (cipher.Block, error) + func NewXteaCipher(key []byte) (cipher.Block, error) + func PCKSPadding(origData []byte, blockSize int) []byte + func PCKSUnPadding(origData []byte) ([]byte, error) + func RandIV(block cipher.Block) ([]byte, error) + func Valid(method, password string) bool + type BlockCrypt interface + BlockSize func() int + Decrypt func(cipherText []byte) ([]byte, error) + Encrypt func(plainText []byte) ([]byte, error) + func NewBlockCipher(key []byte, newCipher func(key []byte) (cipher.Block, error), ...) (BlockCrypt, error) + func NewStreamCipher(key []byte, newCipher func(key []byte) (cipher.Block, error), ...) (BlockCrypt, error) + type BlockOption func(bs *blockBlock) + func WithBlockCodec(newEncrypt, newDecrypt func(block cipher.Block, iv []byte) cipher.BlockMode) BlockOption + func WithBlockRandIV(generateIv func(block cipher.Block) ([]byte, error)) BlockOption + type Cipher struct + Read cipher.Stream + Write cipher.Stream + func NewCipher(method, password string) (*Cipher, error) + type IvSizeError int + func (i IvSizeError) Error() string + type KeyIvLen interface + IvLen func() int + KeyLen func() int + func GetCipher(method string) (KeyIvLen, bool) + type KeySizeError int + func (k KeySizeError) Error() string + type StreamOption func(bs *blockStream) + func WithStreamCodec(newEncrypt, newDecrypt func(block cipher.Block, iv []byte) cipher.Stream) StreamOption + func WithStreamRandIV(generateIv func(block cipher.Block) ([]byte, error)) StreamOption