Documentation ¶
Overview ¶
Package wcipher is a package to encrypt and decrypt data.
Index ¶
- func NewECBDecrypt(block cipher.Block) cipher.BlockMode
- func NewECBEncrypt(block cipher.Block) cipher.BlockMode
- type Cipher
- func NewAES(key []byte) (Cipher, error)
- func NewAESWith(key []byte, mode CipherMode) (Cipher, error)
- func NewBlockCipher(padding Padding, encrypt, decrypt cipher.BlockMode) Cipher
- func NewDES(key []byte) (Cipher, error)
- func NewDESWith(key []byte, mode CipherMode) (Cipher, error)
- func NewStreamCipher(encrypt cipher.Stream, decrypt cipher.Stream) Cipher
- type CipherMode
- type Padding
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewECBDecrypt ¶
NewECBDecrypt ecb decrypt
Types ¶
type Cipher ¶
Cipher provides a unified interface to encrypt/decrypt data.
func NewAES ¶
NewAES Create default AES cipher, use ECB working mode, pkcs57 padding, algorithm secret key length 128 192 256 bits, use secret key as initial vector.
func NewAESWith ¶
func NewAESWith(key []byte, mode CipherMode) (Cipher, error)
NewAESWith According to the specified working mode, create AES cipher, the length of the algorithm secret key is 128 192 256 bits, and the secret key is used as the initial vector.
func NewBlockCipher ¶
NewBlockCipher new block encryption
func NewDES ¶
NewDES Create default DES cipher, use ECB working mode, pkcs57 padding, algorithm secret key length 64 bits, use secret key as initial vector.
func NewDESWith ¶
func NewDESWith(key []byte, mode CipherMode) (Cipher, error)
NewDESWith According to the specified working mode, create DES cipher, the length of the algorithm secret key is 64 bits, and use the secret key as the initial vector.
type CipherMode ¶
type CipherMode interface { SetPadding(padding Padding) CipherMode Cipher(block cipher.Block, iv []byte) Cipher }
CipherMode provides a uniform interface to set the filling method for different operating modes.