crypto

package
v0.0.0-...-e525491 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKeyPair

func GetKeyPair(version *avatar.Version) (avatar.KeyPair, error)

GetKeyPair returns a pair of client encryption keys for the provided client version. If no key pair exists for the provided version, an empty key pair and an "unsupported version" error are returned. The empty key pair should not be used for encryption purposes.

Types

type CipherName

type CipherName string

CipherName captures the name of a supported password encryption cipher.

const (
	None   CipherName = ""
	Bcrypt CipherName = "bcrypt"
)

Supported password ciphers.

func (CipherName) Valid

func (name CipherName) Valid() bool

Valid indicates whether the cipher name is valid.

type GameCryptoService

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

func NewGameCryptoService

func NewGameCryptoService(seed avatar.Seed) (*GameCryptoService, error)

func (GameCryptoService) Decrypt

func (s GameCryptoService) Decrypt(src []byte, dst []byte) error

func (GameCryptoService) Encrypt

func (s GameCryptoService) Encrypt(src []byte, dst []byte) error

func (GameCryptoService) GetSeed

func (s GameCryptoService) GetSeed() avatar.Seed

type LoginCryptoService

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

LoginCryptoService is an avatar.CryptoService compatible with modern "classic" (2D) capable of decrypting data during the login process. LoginCryptoService cannot encrypt data.

LoginCryptoService implements a rolling cipher on both ends. Decrypting data modifies the internal state of the service and affects subsequent decryption operations.

func NewLoginCryptoService

func NewLoginCryptoService(
	seed avatar.Seed,
	version *avatar.Version,
) (*LoginCryptoService, error)

NewLoginCryptoService creates a new LoginCryptoService.

func (*LoginCryptoService) Decrypt

func (cs *LoginCryptoService) Decrypt(src []byte, dst []byte) error

Decrypt src into dst. Bytes in dst are overridden as decryption occurs.

If len(src) > len(dst), up to len(dst) bytes are decrypted and an error is returned.

func (*LoginCryptoService) Encrypt

func (cs *LoginCryptoService) Encrypt(src []byte, dst []byte) error

Encrypt is an invalid operation for LoginCryptoService and always panics.

func (LoginCryptoService) GetSeed

func (cs LoginCryptoService) GetSeed() avatar.Seed

type NilCryptoService

type NilCryptoService struct{}

NilCryptoService is an avatar.CryptoService that does not modify input when encrypting and decrypting data.

func (NilCryptoService) Decrypt

func (c NilCryptoService) Decrypt(src []byte, dst []byte) error

Decrypt src into dst. The bytes copies to dst are equal to those in src.

func (NilCryptoService) Encrypt

func (c NilCryptoService) Encrypt(src []byte, dst []byte) error

Encrypt src into dst. The bytes copies to dst are equal to those in src.

func (NilCryptoService) GetSeed

func (c NilCryptoService) GetSeed() avatar.Seed

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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