Hunter0x7c7
2022-08-11 b8230139fb40edea387617b6accd8371e37eda58
1
2
3
4
5
6
7
8
9
10
11
12
13
package crypto
 
import (
    "crypto/cipher"
 
    "github.com/v2fly/v2ray-core/v5/common/crypto/internal"
)
 
// NewChaCha20Stream creates a new Chacha20 encryption/descryption stream based on give key and IV.
// Caller must ensure the length of key is 32 bytes, and length of IV is either 8 or 12 bytes.
func NewChaCha20Stream(key []byte, iv []byte) cipher.Stream {
    return internal.NewChaCha20Stream(key, iv, 20)
}