decoders

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type XORDecoder

type XORDecoder struct {

	// this is the encryption/decryption key to test with.
	//
	// note: this should be the hexidecimal representation
	// of the ascii characters. if the key is "hello", the
	// value of key should be "68656c6c6f".
	EncryptionKey []byte

	// this is the decoded plaintext message.
	Plaintext string
	// contains filtered or unexported fields
}

structure representing an XOR decoder. this will carry out all the functions related to decoding/decrypting a message that has been encoded using XOR methods.

func NewXORDecoder

func NewXORDecoder(options ...XORDecoderOptsFunc) (decoder *XORDecoder, err error)

function designed to create and initialize a new XORDecoder object.

func (*XORDecoder) XORDecryptWithKey added in v0.0.21

func (xod *XORDecoder) XORDecryptWithKey(offset int) (err error)

function designed to decrypt ciphertext using a key designated by the user.

func (*XORDecoder) XORPreviousPosition

func (xod *XORDecoder) XORPreviousPosition() (err error)

function designed to loop through the ciphertext and xor every evenly positioned hex value with the previously positioned hex value.

type XORDecoderOptions

type XORDecoderOptions struct {
	// if this variable is set, it holds the file in which
	// the ciphertext is saved. this file will be read and
	// the content will be loaded into an XORDecoder's
	// ciphertext variable.
	//
	// note: this cannot be set alongside Ciphertext
	Filename string

	// if this variable is set, it hodls the ciphertext that
	// the XORDecoder will decode.
	//
	// note: this cannot be set alongside Filename.
	Ciphertext []byte

	// this is the encryption/decryption key to test with.
	//
	// note: this cannot be set alongside EncryptionKeyFile
	EncryptionKey []byte

	// if this variable is set, it holds the file in which
	// the encryption key is saved. this file will be read
	// and the encryption key will be loaded into the
	// XORDecoder's EncryptionKey variable.
	//
	// note: this cannot be set alongside EncryptionKey
	EncryptionKeyFile string
}

structure representing an OptsStruct that will hold the configuration options for an XORDecoder object.

type XORDecoderOptsFunc

type XORDecoderOptsFunc func(*XORDecoderOptions) error

function alias that represents a function architecture used to set an XORDecoderOptions variable.

func WithCiphertext

func WithCiphertext(ciphertext []byte) XORDecoderOptsFunc

xordecoderoptsfunc designed to specify the ciphertext to use when attempting to decode.

func WithFile

func WithFile(filename string) XORDecoderOptsFunc

xordecoderoptsfunc designed to specify the name of the file in which the ciphertext is stored.

func WithKey added in v0.0.21

func WithKey(keybytes []byte) XORDecoderOptsFunc

xordecoderoptsfunc designed to specify the encryption key to use.

func WithKeyFile added in v0.0.21

func WithKeyFile(filename string) XORDecoderOptsFunc

xordecoderoptsfunc designed to specify the encryption key file to read the encryption key from.

Jump to

Keyboard shortcuts

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