diff --git a/transport/shadowsocks/core/cipher.go b/transport/shadowsocks/core/cipher.go index 44b2e8d4..c459b2ea 100644 --- a/transport/shadowsocks/core/cipher.go +++ b/transport/shadowsocks/core/cipher.go @@ -61,6 +61,7 @@ var streamList = map[string]struct { "AES-192-CFB": {24, shadowstream.AESCFB}, "AES-256-CFB": {32, shadowstream.AESCFB}, "CHACHA20": {32, shadowstream.ChaCha20}, + "CHACHA8-IETF": {32, shadowstream.Chacha8IETF}, "CHACHA20-IETF": {32, shadowstream.Chacha20IETF}, "XCHACHA20": {32, shadowstream.Xchacha20}, } diff --git a/transport/shadowsocks/shadowstream/cipher.go b/transport/shadowsocks/shadowstream/cipher.go index a357bbf9..173cf37d 100644 --- a/transport/shadowsocks/shadowstream/cipher.go +++ b/transport/shadowsocks/shadowstream/cipher.go @@ -86,6 +86,13 @@ func (k chacha8ietfkey) Encrypter(iv []byte) cipher.Stream { return ciph } +func Chacha8IETF(key []byte) (Cipher, error) { + if len(key) != chacha8.KeySize { + return nil, KeySizeError(chacha8.KeySize) + } + return chacha8ietfkey(key), nil +} + type xchacha20key []byte func (k xchacha20key) IVSize() int { return chacha20.NonceSizeX }