crypto

package
v0.0.0-...-af7cf3d Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LocaleByteToCipher map[byte]byte

Table for converting a Raw Byte to a Ciphered Byte.

View Source
var LocaleCipherToByte map[byte]byte = buildCipherKey()

Table for converting a Ciphered Byte to a Raw Byte.

Functions

func DecipherChar

func DecipherChar(b uint8) (r uint8)

DecipherChar deciphers a byte using the algorithm; please use the tables (CipherToByte and ByteToCipher) instead.

func DecryptBlockXXTEA

func DecryptBlockXXTEA(A *int32, B *int32, keys []int32)

DecryptBlockXXTEA decrypts a block using a given key and the game specific delta and sum values.

A block is comprised of two int32s (taken as pointers). There is no return value (it modifies the input values).

func DecryptBufferXXTEA

func DecryptBufferXXTEA(sourceBuffer []byte, keys []int32) []byte

DecryptBufferXXTEA decrypts bytes from one array into another. There is no errore turn as nothing can really go wrong.

Note: the header should not be included here, this is just XXTea.

func DecryptFileXXTEA

func DecryptFileXXTEA(sourceFile string, destFile string, headerLength int, keys []int32) error

DecryptFileXXTEA decrypts from source to dest, stripping the header (of length 'headerLen'). It requires keys to be passed as an array; these should be 4 int32s.

The header length MUST contain anything unencrypted (typically it will be 20, 16 bytes for the header +4 for the CRC32).

On failure it will return an error (though these will be file related; the decryption system has no way of knowing if it worked or not).

func EncryptBlockXXTEA

func EncryptBlockXXTEA(A *int32, B *int32, keys []int32)

EncryptBlockXXTEA encrypts a block using a given key and the game specific delta and sum values.

A block is comprised of two int32s (taken as pointers). There is no return value (it modifies the input values).

func EncryptBufferXXTEA

func EncryptBufferXXTEA(sourceBuffer []byte, keys []int32) []byte

EncryptBufferXXTEA encrypts bytes from one array into another. There is no errore turn as nothing can really go wrong.

Note: the header should not be included here, this is just XXTea.

func EncryptFileXXTEA

func EncryptFileXXTEA(sourceFile string, destFile string, header []byte, keys []int32) error

EncryptFileXXTEA takes a source name and a destination name, attempting to convert the source into an encrypted destination. It also requires header bytes (theoretically optional, but in reality required for the game to read it) and keys (also required). At present there appear to be common header and keys (listed in the source at the top of xxtea.go).

The CRC32 will be automatically added prior to the data. If you do not need the CRC32 value you should use the buffer encryption (ExcryptXXTea).

On failure it will return an error (though these will be file related; the encryption system has no way of knowing if it worked or not).

Types

This section is empty.

Jump to

Keyboard shortcuts

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