Documentation ¶
Index ¶
- func NewBlowfishCipher(key []byte) (cipher.Block, error)
- func NewCBCDecrypter(block cipher.Block, iv []byte) cipher.Stream
- func NewCBCEncrypter(block cipher.Block, iv []byte) cipher.Stream
- 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 NewTwofishCipher(key []byte) (cipher.Block, error)
- func NewXteaCipher(key []byte) (cipher.Block, error)
- func RandStringBytes(n int) string
- type AnsiX923Padding
- type Base64
- type BlockMode
- type Cipher
- type Codec
- type CodecType
- type Crypto
- type CryptoMethod
- type Hex
- type ISO10126Padding
- type ISO97971Padding
- type IvSizeError
- type KeyIv
- type KeySizeError
- type Mode
- type NewCipher
- type NewStream
- type None
- type NonePadding
- type Option
- type Options
- type PKCS5Padding
- type PKCS7Padding
- type Padding
- type PaddingType
- type UnsupportedError
- type ZeroPadding
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBlowfishCipher ¶
NewBlowfishCipher new blowfish cipher The key argument should be the Blowfish key, from 1 to 56 bytes.
func NewCast5Cipher ¶
NewCast5Cipher new cast5 cipher, The key size should 32
func NewChacha20 ¶
NewChacha20 new chacha20 key size should 32, iv size should one of 12,24
func NewSalsa20 ¶
NewSalsa20 new salsa20 key size should 32, iv size should one of 8
func NewTwofishCipher ¶
NewTwofishCipher new twofish cipher The key argument should be the Twofish key, 16, 24 or 32 bytes.
func NewXteaCipher ¶
NewXteaCipher new xtea cipher The key argument should be the XTEA key. XTEA only supports 128 bit (16 byte) keys.
func RandStringBytes ¶
Types ¶
type AnsiX923Padding ¶
type AnsiX923Padding struct { }
type Crypto ¶
func NewChipher ¶
func NewChipher(method CryptoMethod, key, iv string, opts ...Option) (Crypto, error)
type CryptoMethod ¶
type CryptoMethod string
const ( Aes128Cbc CryptoMethod = "aes-128-cbc" Aes192Cbc CryptoMethod = "aes-192-cbc" Aes256Cbc CryptoMethod = "aes-256-cbc" Aes128Cfb CryptoMethod = "aes-128-cfb" Aes192Cfb CryptoMethod = "aes-192-cfb" Aes256Cfb CryptoMethod = "aes-256-cfb" Aes128Ctr CryptoMethod = "aes-128-ctr" Aes192Ctr CryptoMethod = "aes-192-ctr" Aes256Ctr CryptoMethod = "aes-256-ctr" Aes128Ofb CryptoMethod = "aes-128-ofb" Aes192Ofb CryptoMethod = "aes-192-ofb" Aes256Ofb CryptoMethod = "aes-256-ofb" DesCbc CryptoMethod = "des-cbc" DesCfb CryptoMethod = "des-cfb" DesCtr CryptoMethod = "des-ctr" DesOfb CryptoMethod = "des-ofb" Des3Cfb CryptoMethod = "3des-cfb" Des3Ctr CryptoMethod = "3des-ctr" Des3Ofb CryptoMethod = "3des-ofb" BlowfishCbc CryptoMethod = "blowfish-cbc" BlowfishCfb CryptoMethod = "blowfish-cfb" BlowfishCtr CryptoMethod = "blowfish-ctr" BlowfishOfb CryptoMethod = "blowfish-ofb" Cast5Cbc CryptoMethod = "cast5-cbc" Cast5Cfb CryptoMethod = "cast5-cfb" Cast5Ctr CryptoMethod = "cast5-ctr" Cast5Ofb CryptoMethod = "cast5-ofb" Twofish128CBC CryptoMethod = "twofish-128-cbc" Twofish192CBC CryptoMethod = "twofish-192-cbc" Twofish256CBC CryptoMethod = "twofish-256-cbc" Twofish128Cfb CryptoMethod = "twofish-128-cfb" Twofish192Cfb CryptoMethod = "twofish-192-cfb" Twofish256Cfb CryptoMethod = "twofish-256-cfb" Twofish128Ctr CryptoMethod = "twofish-128-ctr" Twofish192Ctr CryptoMethod = "twofish-192-ctr" Twofish256Ctr CryptoMethod = "twofish-256-ctr" Twofish128Ofb CryptoMethod = "twofish-128-ofb" Twofish192Ofb CryptoMethod = "twofish-192-ofb" Twofish256Ofb CryptoMethod = "twofish-256-ofb" XteaCbc CryptoMethod = "xtea-cbc" XteaCfb CryptoMethod = "xtea-cfb" XteaCtr CryptoMethod = "xtea-ctr" XteaOfb CryptoMethod = "xtea-ofb" TeaCbc CryptoMethod = "tea-cbc" TeaCfb CryptoMethod = "tea-cfb" TeaCtr CryptoMethod = "tea-ctr" TeaOfb CryptoMethod = "tea-ofb" Rc4Md5 CryptoMethod = "rc4-md5" Rc4Md5_6 CryptoMethod = "rc4-md5-6" Chacha20 CryptoMethod = "chacha20" Chacha20_Ietf CryptoMethod = "chacha20-ietf" Salsa20 CryptoMethod = "salsa20" )
type ISO10126Padding ¶
type ISO10126Padding struct { }
type ISO97971Padding ¶
type ISO97971Padding struct { }
type NonePadding ¶
type NonePadding struct { }
type Option ¶
type Option func(*Options)
func WithPadding ¶
func WithPadding(padding PaddingType) Option
type PKCS5Padding ¶
type PKCS5Padding struct { }
type PKCS7Padding ¶
type PKCS7Padding struct { }
type PaddingType ¶
type PaddingType string
const ( PaddingTypeNone PaddingType = "NonePadding" PaddingTypeAnsiX923 PaddingType = "AnsiX923Padding" PaddingTypeISO10126 PaddingType = "ISO10126Padding" PaddingTypeISO97971 PaddingType = "ISO97971Padding" PaddingTypePKCS7 PaddingType = "PKCS7Padding" PaddingTypePKCS5 PaddingType = "PKCS5Padding" PaddingTypeZero PaddingType = "ZeroPadding" )
type UnsupportedError ¶
type UnsupportedError string
func (UnsupportedError) Error ¶
func (s UnsupportedError) Error() string
Error implement Error interface
type ZeroPadding ¶
type ZeroPadding struct { }
ZeroPadding 使用0填充有个缺点,当元数据尾部也存在0时,在unpadding时可能会存在问题
Source Files ¶
Click to show internal directories.
Click to hide internal directories.