Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CipherMap = map[CipherType]Cipher{ CipherType_AES_128_CTR: &StreamCipher{ KeyBytes: 16, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cipher.NewCTR), }, CipherType_AES_192_CTR: &StreamCipher{ KeyBytes: 24, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cipher.NewCTR), }, CipherType_AES_256_CTR: &StreamCipher{ KeyBytes: 32, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cipher.NewCTR), }, CipherType_AES_128_CFB: &StreamCipher{ KeyBytes: 16, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cipher.NewCFBEncrypter), }, CipherType_AES_192_CFB: &StreamCipher{ KeyBytes: 24, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cipher.NewCFBEncrypter), }, CipherType_AES_256_CFB: &StreamCipher{ KeyBytes: 32, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cipher.NewCFBEncrypter), }, CipherType_AES_128_CFB8: &StreamCipher{ KeyBytes: 16, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cfb8.NewEncrypter), }, CipherType_AES_192_CFB8: &StreamCipher{ KeyBytes: 24, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cfb8.NewEncrypter), }, CipherType_AES_256_CFB8: &StreamCipher{ KeyBytes: 32, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cfb8.NewEncrypter), }, CipherType_AES_128_OFB: &StreamCipher{ KeyBytes: 16, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cipher.NewOFB), }, CipherType_AES_192_OFB: &StreamCipher{ KeyBytes: 24, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cipher.NewOFB), }, CipherType_AES_256_OFB: &StreamCipher{ KeyBytes: 32, IVBytes: aes.BlockSize, EncryptCreator: blockStream(aes.NewCipher, cipher.NewOFB), }, CipherType_SALSA20: &StreamCipher{ KeyBytes: 32, IVBytes: 8, EncryptCreator: salsa20.New, }, CipherType_CHACHA20: &StreamCipher{ KeyBytes: chacha.KeySize, IVBytes: chacha.NonceSize, EncryptCreator: func(key []byte, iv []byte) (cipher.Stream, error) { return chacha20.NewCipher(iv, key) }, }, CipherType_CHACHA20_IETF: &StreamCipher{ KeyBytes: chacha.KeySize, IVBytes: chacha.INonceSize, EncryptCreator: func(key []byte, iv []byte) (cipher.Stream, error) { return chacha20.NewCipher(iv, key) }, }, CipherType_XCHACHA20: &StreamCipher{ KeyBytes: chacha.KeySize, IVBytes: chacha.INonceSize, EncryptCreator: func(key []byte, iv []byte) (cipher.Stream, error) { return chacha20.NewCipher(iv, key) }, }, CipherType_RC4: &StreamCipher{ KeyBytes: 16, IVBytes: 0, EncryptCreator: func(key []byte, iv []byte) (cipher.Stream, error) { return rc4.NewCipher(key) }, }, CipherType_RC4_MD5: &StreamCipher{ KeyBytes: 16, IVBytes: 16, EncryptCreator: func(key []byte, iv []byte) (cipher.Stream, error) { h := md5.New() h.Write(key) h.Write(iv) return rc4.NewCipher(h.Sum(nil)) }, }, CipherType_BF_CFB: &StreamCipher{ KeyBytes: 16, IVBytes: blowfish.BlockSize, EncryptCreator: blockStream(func(key []byte) (cipher.Block, error) { return blowfish.NewCipher(key) }, cipher.NewCFBEncrypter), }, CipherType_CAST5_CFB: &StreamCipher{ KeyBytes: 16, IVBytes: cast5.BlockSize, EncryptCreator: blockStream(func(key []byte) (cipher.Block, error) { return cast5.NewCipher(key) }, cipher.NewCFBEncrypter), }, CipherType_DES_CFB: &StreamCipher{ KeyBytes: 8, IVBytes: des.BlockSize, EncryptCreator: blockStream(des.NewCipher, cipher.NewCFBEncrypter), }, CipherType_IDEA_CFB: &StreamCipher{ KeyBytes: 16, IVBytes: 8, EncryptCreator: blockStream(idea.NewCipher, cipher.NewCFBEncrypter), }, CipherType_RC2_CFB: &StreamCipher{ KeyBytes: 16, IVBytes: rc2.BlockSize, EncryptCreator: blockStream(func(key []byte) (cipher.Block, error) { return rc2.New(key, 16) }, cipher.NewCFBEncrypter), }, CipherType_SEED_CFB: &StreamCipher{ KeyBytes: 16, IVBytes: seed.BlockSize, EncryptCreator: blockStream(seed.NewCipher, cipher.NewCFBEncrypter), }, CipherType_CAMELLIA_128_CFB: &StreamCipher{ KeyBytes: 16, IVBytes: camellia.BlockSize, EncryptCreator: blockStream(camellia.New, cipher.NewCFBEncrypter), }, CipherType_CAMELLIA_192_CFB: &StreamCipher{ KeyBytes: 24, IVBytes: camellia.BlockSize, EncryptCreator: blockStream(camellia.New, cipher.NewCFBEncrypter), }, CipherType_CAMELLIA_256_CFB: &StreamCipher{ KeyBytes: 32, IVBytes: camellia.BlockSize, EncryptCreator: blockStream(camellia.New, cipher.NewCFBEncrypter), }, CipherType_CAMELLIA_128_CFB8: &StreamCipher{ KeyBytes: 16, IVBytes: camellia.BlockSize, EncryptCreator: blockStream(camellia.New, cfb8.NewEncrypter), }, CipherType_CAMELLIA_192_CFB8: &StreamCipher{ KeyBytes: 24, IVBytes: camellia.BlockSize, EncryptCreator: blockStream(camellia.New, cfb8.NewEncrypter), }, CipherType_CAMELLIA_256_CFB8: &StreamCipher{ KeyBytes: 32, IVBytes: camellia.BlockSize, EncryptCreator: blockStream(camellia.New, cfb8.NewEncrypter), }, }
Functions ¶
func EncodeHeaderChain ¶
func EncodeHeaderChain(destination net.Destination, account Account, rounds int) []byte
func ParseDestination ¶
func ParseDestination(dest net.Destination) []byte
Types ¶
type Account ¶
func CreateAccount ¶
type CipherType ¶
type CipherType int
const ( CipherType_UNKNOWN CipherType = iota CipherType_AES_128_CTR CipherType_AES_192_CTR CipherType_AES_256_CTR CipherType_AES_128_CFB CipherType_AES_192_CFB CipherType_AES_256_CFB CipherType_AES_128_CFB8 CipherType_AES_192_CFB8 CipherType_AES_256_CFB8 CipherType_AES_128_OFB CipherType_AES_192_OFB CipherType_AES_256_OFB CipherType_SALSA20 CipherType_CHACHA20 CipherType_CHACHA20_IETF CipherType_XCHACHA20 CipherType_RC4 CipherType_RC4_MD5 CipherType_BF_CFB CipherType_CAST5_CFB CipherType_DES_CFB CipherType_IDEA_CFB CipherType_RC2_CFB CipherType_SEED_CFB CipherType_CAMELLIA_128_CFB CipherType_CAMELLIA_192_CFB CipherType_CAMELLIA_256_CFB CipherType_CAMELLIA_128_CFB8 CipherType_CAMELLIA_192_CFB8 CipherType_CAMELLIA_256_CFB8 )
func CipherFromString ¶
func CipherFromString(method string) (CipherType, error)
type StreamCipher ¶
type StreamCipher struct { KeyBytes int32 IVBytes int32 EncryptCreator func(key []byte, iv []byte) (cipher.Stream, error) }
func (*StreamCipher) EncodePacket ¶
func (v *StreamCipher) EncodePacket(key []byte, b []byte) error
func (*StreamCipher) IVSize ¶
func (v *StreamCipher) IVSize() int32
func (*StreamCipher) KeySize ¶
func (v *StreamCipher) KeySize() int32
Click to show internal directories.
Click to hide internal directories.