This commit is contained in:
passingwang 2024-07-19 16:51:39 +08:00
parent 5209985a19
commit 89c2205d40
2 changed files with 8 additions and 0 deletions

View file

@ -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},
}

View file

@ -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 }