crypto

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectionRSAKey = `` /* 1678-byte string literal not displayed */

Variables

This section is empty.

Functions

func Adler32

func Adler32(d uint32, p []byte) uint32

Add p to the running checksum d.

func GenEnableEncryptionSignature

func GenEnableEncryptionSignature(encryptKey []byte) ([]byte, error)

func GetConnectionRSAKey

func GetConnectionRSAKey() *rsa.PrivateKey

func Hash

func Hash(hsh func() hash.Hash, input ...[]byte) []byte

func RandBytes

func RandBytes(ln int) []byte

func RandUint32

func RandUint32(min, max uint32) uint32

Generate a pseudo-random integer

func ReverseBytes

func ReverseBytes(bytes []byte)

func SHA1

func SHA1(input ...[]byte) []byte

Types

type AesCipher

type AesCipher struct {
	// contains filtered or unexported fields
}

func (*AesCipher) Decrypt

func (aec *AesCipher) Decrypt(data, tag []byte) error

func (*AesCipher) Encrypt

func (aec *AesCipher) Encrypt(data, tag []byte) error

func (*AesCipher) Init

func (aec *AesCipher) Init(server bool, key []byte) error

type Cipher

type Cipher interface {
	Init(server bool, key []byte) error
	Encrypt(data, tag []byte) error
	Decrypt(data, tag []byte) error
}

Cipher describes some method for setting up an encryption layer over a TCP socket.

func NewCipher

func NewCipher(version vsn.Build, sessionKey []byte, server bool) (Cipher, error)

type DummyCipher

type DummyCipher struct {
}

func (DummyCipher) Decrypt

func (d DummyCipher) Decrypt(data, tag []byte) error

func (DummyCipher) Encrypt

func (d DummyCipher) Encrypt(data, tag []byte) error

func (DummyCipher) Init

func (d DummyCipher) Init(server bool, key []byte) error

type SessionKeyGenerator

type SessionKeyGenerator struct {
	HashFunc func() hash.Hash
	Seeds    [3][]byte
}

func NewSessionKeyGenerator

func NewSessionKeyGenerator(hashFunc func() hash.Hash, data []byte) *SessionKeyGenerator

func (*SessionKeyGenerator) Read

func (skg *SessionKeyGenerator) Read(data []byte) (int, error)

Directories

Path Synopsis
Package arc4 provides multiple implementations of RC4-based socket encryption methods.
Package arc4 provides multiple implementations of RC4-based socket encryption methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL