Documentation ¶
Overview ¶
Package crypto provides common crypto libraries for V2Ray.
Index ¶
- func NewAesDecryptionStream(key []byte, iv []byte) cipher.Stream
- func NewAesEncryptionStream(key []byte, iv []byte) cipher.Stream
- func NewChaCha20Stream(key []byte, iv []byte) cipher.Stream
- type AEADAuthenticator
- type AuthenticationReader
- type AuthenticationWriter
- type Authenticator
- type BytesGenerator
- type CryptionReader
- type CryptionWriter
- type NoOpBytesGenerator
- type ShakeUint16Generator
- type StaticBytesGenerator
- type StaticUint16Generator
- type Uint16Generator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAesDecryptionStream ¶
NewAesDecryptionStream creates a new AES encryption stream based on given key and IV. Caller must ensure the length of key and IV is either 16, 24 or 32 bytes.
func NewAesEncryptionStream ¶
NewAesEncryptionStream creates a new AES description stream based on given key and IV. Caller must ensure the length of key and IV is either 16, 24 or 32 bytes.
Types ¶
type AEADAuthenticator ¶ added in v1.1.0
type AEADAuthenticator struct { cipher.AEAD NonceGenerator BytesGenerator AdditionalDataGenerator BytesGenerator }
type AuthenticationReader ¶ added in v1.1.0
type AuthenticationReader struct {
// contains filtered or unexported fields
}
func NewAuthenticationReader ¶ added in v1.1.0
func NewAuthenticationReader(auth Authenticator, reader io.Reader, sizeMask Uint16Generator) *AuthenticationReader
type AuthenticationWriter ¶ added in v1.1.0
type AuthenticationWriter struct {
// contains filtered or unexported fields
}
func NewAuthenticationWriter ¶ added in v1.1.0
func NewAuthenticationWriter(auth Authenticator, writer io.Writer, sizeMask Uint16Generator) *AuthenticationWriter
type Authenticator ¶ added in v1.1.0
type BytesGenerator ¶ added in v1.1.0
type BytesGenerator interface {
Next() []byte
}
type CryptionReader ¶ added in v1.1.0
type CryptionReader struct {
// contains filtered or unexported fields
}
func NewCryptionReader ¶
func NewCryptionReader(stream cipher.Stream, reader io.Reader) *CryptionReader
type CryptionWriter ¶ added in v1.1.0
type CryptionWriter struct {
// contains filtered or unexported fields
}
func NewCryptionWriter ¶
func NewCryptionWriter(stream cipher.Stream, writer io.Writer) *CryptionWriter
NewCryptionWriter creates a new CryptionWriter.
type NoOpBytesGenerator ¶
type NoOpBytesGenerator struct {
// contains filtered or unexported fields
}
func (NoOpBytesGenerator) Next ¶
func (v NoOpBytesGenerator) Next() []byte
type ShakeUint16Generator ¶
type ShakeUint16Generator struct {
// contains filtered or unexported fields
}
func NewShakeUint16Generator ¶
func NewShakeUint16Generator(nonce []byte) *ShakeUint16Generator
func (*ShakeUint16Generator) Next ¶
func (g *ShakeUint16Generator) Next() uint16
type StaticBytesGenerator ¶
type StaticBytesGenerator struct {
Content []byte
}
func (StaticBytesGenerator) Next ¶
func (v StaticBytesGenerator) Next() []byte
type StaticUint16Generator ¶
type StaticUint16Generator uint16
func (StaticUint16Generator) Next ¶
func (g StaticUint16Generator) Next() uint16
type Uint16Generator ¶
type Uint16Generator interface {
Next() uint16
}
Click to show internal directories.
Click to hide internal directories.