Documentation ¶
Index ¶
- Constants
- Variables
- func NewGcm(key []byte) (cipher.AEAD, error)
- type CipherConf
- type DecOrEnc
- type NoneStream
- type StreamCipher
- func (c *StreamCipher) Clone() *StreamCipher
- func (c *StreamCipher) Decrypt(dst, src []byte)
- func (c *StreamCipher) DecryptInited() bool
- func (c *StreamCipher) Encrypt(dst, src []byte)
- func (c *StreamCipher) EncryptInited() bool
- func (c *StreamCipher) IV() []byte
- func (c *StreamCipher) InfoIVLen() int
- func (c *StreamCipher) InfoKeyLen() int
- func (c *StreamCipher) InitDecrypt(iv []byte) (err error)
- func (c *StreamCipher) InitEncrypt() (iv []byte, err error)
- func (c *StreamCipher) Key() []byte
- func (c *StreamCipher) NewDecryptor(iv []byte) (dec cipher.Stream, err error)
- func (c *StreamCipher) NewEncryptor(iv []byte) (enc cipher.Stream, err error)
- func (c *StreamCipher) SetIV(iv []byte)
- func (c *StreamCipher) SetKey(key []byte)
Constants ¶
View Source
const ( MaxNonceSize = 12 ATypeIpv4 = 1 ATypeDomain = 3 ATypeIpv6 = 4 )
Variables ¶
View Source
var ( AeadCiphersConf = map[string]*CipherConf{ "chacha20-ietf-poly1305": {KeyLen: 32, SaltLen: 32, NonceLen: 12, TagLen: 16, NewCipher: chacha20poly1305.New}, "chacha20-poly1305": {KeyLen: 32, SaltLen: 32, NonceLen: 12, TagLen: 16, NewCipher: chacha20poly1305.New}, "aes-256-gcm": {KeyLen: 32, SaltLen: 32, NonceLen: 12, TagLen: 16, NewCipher: NewGcm}, "aes-128-gcm": {KeyLen: 16, SaltLen: 16, NonceLen: 12, TagLen: 16, NewCipher: NewGcm}, } ZeroNonce [MaxNonceSize]byte ShadowsocksReusedInfo = []byte("ss-subkey") JuicityReusedInfo = []byte("juicity-reused-info") )
Functions ¶
Types ¶
type CipherConf ¶
type NoneStream ¶
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.Clone() to create a new cipher with the same method and password to avoid the cost of repeated cipher initialization.
func (*StreamCipher) Clone ¶
func (c *StreamCipher) Clone() *StreamCipher
Clone 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)
InitEncrypt initializes the block cipher with CFB mode, returns IV.
func (*StreamCipher) Key ¶
func (c *StreamCipher) Key() []byte
func (*StreamCipher) NewDecryptor ¶
func (c *StreamCipher) NewDecryptor(iv []byte) (dec cipher.Stream, err error)
func (*StreamCipher) NewEncryptor ¶
func (c *StreamCipher) NewEncryptor(iv []byte) (enc cipher.Stream, err error)
func (*StreamCipher) SetIV ¶
func (c *StreamCipher) SetIV(iv []byte)
func (*StreamCipher) SetKey ¶
func (c *StreamCipher) SetKey(key []byte)
Click to show internal directories.
Click to hide internal directories.