encrypt

package
v0.0.0-...-7767ede Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

README

pkg/encrypt

Encryption and decryption utilities for handle the app requests. Probably they can be used at another repositories.

compress.go

It has gzip utility functions. The request and responses must use gzip.

padding.go

It has the padding and un-padding utility functions. The game encryption algorithm uses blocks of 16 bytes.

sparkle_cipher.go

it has the core functions of encryption and decryptions for use at the app requests. It uses compress and padding functions automatically.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key string

type Pad

type Pad string

type SparkleCipher

type SparkleCipher struct {
	BLOCK_SIZE int
	// contains filtered or unexported fields
}

func NewSparkleCipher

func NewSparkleCipher(key Key, padding Pad) *SparkleCipher

func (*SparkleCipher) DecryptAsRequest

func (k *SparkleCipher) DecryptAsRequest(path string, body string, result any) error

func (*SparkleCipher) DecryptAsRequestBytes

func (k *SparkleCipher) DecryptAsRequestBytes(path string, body string) ([]byte, error)

func (*SparkleCipher) EncryptAsResponse

func (k *SparkleCipher) EncryptAsResponse(path string, body interface{}) []byte

func (*SparkleCipher) EncryptAsResponseByBytes

func (k *SparkleCipher) EncryptAsResponseByBytes(path string, data []byte) []byte

func (*SparkleCipher) GetStarCC

func (k *SparkleCipher) GetStarCC(body interface{}, serverTime string) string

func (*SparkleCipher) GetStarCCByBytes

func (k *SparkleCipher) GetStarCCByBytes(body []byte, serverTime string) string

type SparkleCipherRepository

type SparkleCipherRepository interface {
	GetStarCC(body interface{}, serverTime string) string

	DecryptAsRequest(path string, body string, res any) error
	EncryptAsResponse(path string, body interface{}) string
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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