mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-12-23 03:43:33 +02:00
13 lines
405 B
Go
13 lines
405 B
Go
package crypto
|
|
|
|
import (
|
|
"crypto/cipher"
|
|
|
|
"github.com/xtls/xray-core/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)
|
|
}
|